瀏覽代碼

small bug fix

gediminasm 14 年之前
父節點
當前提交
64b2fa5ae4
共有 3 個文件被更改,包括 6 次插入3 次删除
  1. 2 1
      .gitignore
  2. 1 1
      README.markdown
  3. 3 1
      lib/DoctrineExtensions/Sluggable/SluggableListener.php

+ 2 - 1
.gitignore

@@ -1,2 +1,3 @@
 tests/phpunit.xml
-build/
+build/
+scripts/

+ 1 - 1
README.markdown

@@ -311,6 +311,6 @@ To save **Article** and generate slug simply use:
     $this->em->flush();
 
     echo $article->getSlug();
-    // prints: the-title-my-slug
+    // prints: the-title-my-code
     
     

+ 3 - 1
lib/DoctrineExtensions/Sluggable/SluggableListener.php

@@ -280,7 +280,9 @@ class SluggableListener implements EventSubscriber
         // include identifiers
         $entityIdentifiers = $entityClassMetadata->getIdentifierValues($entity);
         foreach ($entityIdentifiers as $field => $value) {
-        	$qb->where('rec.' . $field . ' <> ' . $value);
+        	if (strlen($value)) {
+                $qb->where('rec.' . $field . ' <> ' . $value);
+        	}
         }
         $q = $qb->getQuery();
         $q->setHydrationMode(Query::HYDRATE_ARRAY);