Patch too many queries sluggable #485

Merged
merged 5 commits into from Dec 10, 2012

Conversation

Projects
None yet
4 participants
Member

jaugustin commented Oct 20, 2012

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.

Member

jaugustin commented Oct 22, 2012

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

Owner

willdurand commented Oct 22, 2012

Alright ;)

Divi and others added some commits Aug 14, 2012

Too many queries for the makeSlugUnique method
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.
Member

jaugustin commented Dec 10, 2012

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

Member

jaugustin commented Dec 10, 2012

@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

1 check passed

default The Travis build passed
Details
Owner

willdurand commented Dec 10, 2012

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)));
@havvg

havvg Dec 19, 2012

Member

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