Gunther Konig 12 年之前
父节点
当前提交
eb7f2b8088
共有 2 个文件被更改,包括 2 次插入2 次删除
  1. 1 1
      lib/Gedmo/Sluggable/Mapping/Driver/Annotation.php
  2. 1 1
      tests/Gedmo/Sluggable/MappedSuperclassTest.php

+ 1 - 1
lib/Gedmo/Sluggable/Mapping/Driver/Annotation.php

@@ -80,7 +80,7 @@ class Annotation extends AbstractAnnotationDriver
                 if (!is_bool($slug->unique)) {
                     throw new InvalidMappingException("Slug annotation [unique], type is not valid and must be 'boolean' in class - {$meta->name}");
                 }
-                if ($meta->isIdentifier($field) && !(bool)$slug->unique) {
+                if (!empty($meta->identifier) && $meta->isIdentifier($field) && !(bool)$slug->unique) {
                     throw new InvalidMappingException("Identifier field - [{$field}] slug must be unique in order to maintain primary key in class - {$meta->name}");
                 }
                 // set all options

+ 1 - 1
tests/Gedmo/Sluggable/MappedSuperclassTest.php

@@ -4,7 +4,7 @@ namespace Gedmo\Sluggable;
 
 use Doctrine\Common\EventManager;
 use Tool\BaseTestCaseORM;
-use Sluggable\Fixture\Article;
+use Sluggable\Fixture\MappedSuperclass\Car;
 
 /**
  * These are tests for sluggable behavior