Permalink
Browse files

Fix LIKE condition

  • Loading branch information...
1 parent dc31f15 commit 39a5beedc930a1937bd91589565e1118bff79af7 @Divi Divi committed Aug 14, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 generator/lib/behavior/sluggable/SluggableBehavior.php
View
5 generator/lib/behavior/sluggable/SluggableBehavior.php
@@ -266,7 +266,7 @@ public function addMakeSlugUnique(&$script)
*
* @param string \$slug the slug to check
* @param string \$separator the separator used by slug
- * @param boolean \$alreadyExists false for the first try, true for the second, and take the high count + 1
+ * @param int \$alreadyExists false for the first try, true for the second, and take the high count + 1
* @return string the unique slug
*/
protected function makeSlugUnique(\$slug, \$separator = '" . $this->getParameter('separator') ."', \$alreadyExists = false)
@@ -279,7 +279,8 @@ protected function makeSlugUnique(\$slug, \$separator = '" . $this->getParameter
}
\$count = " . $this->builder->getStubQueryBuilder()->getClassname() . "::create()
- ->filterBySlug(\$slug2 . '%')";
+ ->filterBySlug(\$alreadyExists ? \$slug2 . '%' : \$slug2)
+ ->prune(\$this)";
if ($this->getParameter('scope_column')) {
$getter = 'get' . $this->getColumnForParameter('scope_column')->getPhpName();

0 comments on commit 39a5bee

Please sign in to comment.