Ver código fonte

Merge pull request #496 from userfriendly/patch-1

YAML mapping: Check if field mapped as sluggable is identifier only in entities, not mapped superclasses.
Gediminas Morkevicius 12 anos atrás
pai
commit
3b16d0c17a
1 arquivos alterados com 1 adições e 1 exclusões
  1. 1 1
      lib/Gedmo/Sluggable/Mapping/Driver/Yaml.php

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

@@ -80,7 +80,7 @@ class Yaml extends File implements Driver
                         $config['slugs'][$field]['separator'] = isset($slug['separator']) ?
                             (string)$slug['separator'] : '-';
 
-                        if ($meta->isIdentifier($field) && !$config['slugs'][$field]['unique']) {
+                        if (!$meta->isMappedSuperclass && $meta->isIdentifier($field) && !$config['slugs'][$field]['unique']) {
                             throw new InvalidMappingException("Identifier field - [{$field}] slug must be unique in order to maintain primary key in class - {$meta->name}");
                         }
                     }