Jelajahi Sumber

small bug fix

gediminasm 14 tahun lalu
induk
melakukan
64b2fa5ae4
3 mengubah file dengan 6 tambahan dan 3 penghapusan
  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);