Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
39 | public function loadClassMetadata(ClassMetadataInterface $classMetadata) |
||
40 | { |
||
41 | /** @var Publishable $annotation */ |
||
42 | if (!$annotation = $this->reader->getClassAnnotation($classMetadata->getReflectionClass(), Publishable::class)) { |
||
43 | return true; |
||
44 | } |
||
45 | |||
46 | if (!$attributeMetadata = ($classMetadata->getAttributesMetadata()[$annotation->fieldName] ?? null)) { |
||
47 | throw new MappingException(sprintf('Groups on "%s::%s" cannot be added because the field does not exist.', $classMetadata->getName(), $annotation->fieldName)); |
||
48 | } |
||
49 | |||
50 | $attributeMetadata->addGroup(sprintf('%s:publishable', $classMetadata->getName())); |
||
51 | |||
52 | return true; |
||
53 | } |
||
55 |