| Total Complexity | 3 |
| Total Lines | 28 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class RouteAwareModifier extends AbstractModifier |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @param RouteAwareInterface $object |
||
| 13 | * @param array $context |
||
| 14 | * @param null|string $format |
||
| 15 | * @return object|void |
||
| 16 | */ |
||
| 17 | public function process($object, array $context = array(), ?string $format = null) |
||
| 18 | { |
||
| 19 | /** @var RouteFactory $routeFactory */ |
||
| 20 | $routeFactory = $this->container->get(RouteFactory::class); |
||
| 21 | /** @var EntityManagerInterface $em */ |
||
| 22 | $em = $this->container->get(EntityManagerInterface::class); |
||
| 23 | $routeFactory->createPageRoute($object, $em); |
||
| 24 | $em->flush(); |
||
| 25 | } |
||
| 26 | |||
| 27 | public function supportsData($data): bool |
||
| 28 | { |
||
| 29 | return $data instanceof RouteAwareInterface; |
||
| 30 | } |
||
| 31 | |||
| 32 | public static function getSubscribedServices(): array |
||
| 37 | ]; |
||
| 38 | } |
||
| 39 | } |
||
| 40 |