Conditions | 4 |
Paths | 5 |
Total Lines | 14 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
31 | public function accept(ReflectionProperty $property, Entity $entity, $annotation): void |
||
32 | { |
||
33 | if (!($annotation instanceof TargetEntity)) { |
||
34 | return; |
||
35 | } |
||
36 | $context = $this->contextFactory->createFromReflector($property); |
||
37 | $className = $this->resolver->resolve($annotation->value, $context); |
||
38 | $mapping = $entity->getMapping()->requestProperty($property->getName()); |
||
39 | $views = [$mapping->getDefaultView()]; |
||
40 | if (!empty($annotation->views)) { |
||
41 | $views = $mapping->requestViews(...$annotation->views); |
||
42 | } |
||
43 | foreach ($views as $view) { |
||
44 | $view->setTargetClass((string) $className); |
||
45 | } |
||
48 |