Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch too many queries sluggable #485

Merged

Conversation

jaugustin
Copy link
Member

This PR replace #447

I squashed @Divi commits, fix CS.
I added test to prove that MakeUniqSlug was doing n query where n is the number of duplicate slug.

@jaugustin
Copy link
Member Author

Do not merge now, @Divi found a bug, we need to patch it before merge

@willdurand
Copy link
Contributor

Alright ;)

Divi and others added 5 commits December 10, 2012 16:45
There is a problem with the method makeSlugUnique, indeed, when you choose just one column to sluggable and if this column can be exists many time in the database, the makeSlugUnique will be launched as many times that you have a line with the same column value.

For exemple, if you have a column "label", and a categoy with label value : "Home", now try to insert new row 100 times with the label value "Home", the makeUniqueSlug with be launched n+1 times at each row.

So, I changed the method : try one time without ending separator, and if the line already exists, I try one more time but with the ending sepator and the count + 1 times of the line exists. So two queries max per line.

Miss PHP Doc'

Fix LIKE condition

Some fixes when update object & without pattern

Fix method name

Oops... fix count query

Fix object without pattern

Sorry, can't launch test myself atm.
@jaugustin
Copy link
Member Author

Wait for travis to run test but it should be good now :)

@jaugustin
Copy link
Member Author

@willdurand you can merge this PR ;) all green

willdurand added a commit that referenced this pull request Dec 10, 2012
@willdurand willdurand merged commit ce4c833 into propelorm:master Dec 10, 2012
@willdurand
Copy link
Contributor

Thank ou guys.

jaugustin added a commit to jaugustin/Propel that referenced this pull request Dec 11, 2012
willdurand added a commit that referenced this pull request Dec 11, 2012

foreach ($matches[1] as $key => $match) {

$column = $this->getTable()->getColumn($this->underscore(ucfirst($match)));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks conjunction with DelegateBehavior, where a column of the pattern is provided by the target class ("parent") and not by this class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants