Pārlūkot izejas kodu

[sluggable] fixed yaml mapping issue when there is no parameters set and sluggable is not an array key

Helmer Aaviksoo 14 gadi atpakaļ
vecāks
revīzija
450fd059b2
1 mainītis faili ar 1 papildinājumiem un 1 dzēšanām
  1. 1 1
      lib/Gedmo/Sluggable/Mapping/Driver/Yaml.php

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

@@ -69,7 +69,7 @@ class Yaml extends File implements Driver
                         if (!$this->isValidField($meta, $field)) {
                             throw new InvalidMappingException("Cannot slug field - [{$field}] type is not valid and must be 'string' in class - {$meta->name}");
                         }
-                        $sluggable = $fieldMapping['gedmo']['sluggable'];
+                        $sluggable = (isset($fieldMapping['gedmo']['sluggable'])? $fieldMapping['gedmo']['sluggable']:array());
                         $slugField = (isset($sluggable['slugField'])? $sluggable['slugField']:'slug');
                         $position = (isset($sluggable['position'])? $sluggable['position']:0);
                         $config['fields'][$slugField][] = array('field' => $field, 'position' => $position, 'slugField' => $slugField);