/** * @dataProvider getHasControllerInAnnotation */ public function testHasControllerInAnnotation($bundle, $controller, $config, $expected) { $configurationPath = $this->tmpDir . '/routing.yml'; file_put_contents($configurationPath, $config); $manipulator = new RESTRoutingManipulator($configurationPath); $result = $manipulator->hasControllerInAnnotation($bundle, $controller); $this->assertEquals($expected, $result); }
protected function updateAnnotationRouting(BundleInterface $bundle, $entity, $prefix) { $rootDir = $this->getContainer()->getParameter('kernel.root_dir'); $parts = explode('\\', $entity); $controller = array_pop($parts); $routing = new RoutingManipulator($bundle->getPath() . '/Resources/config/routing.yml'); if (!$routing->hasControllerInAnnotation($bundle->getName(), $controller)) { $ret = $routing->addRESTController($bundle->getName(), $controller); } }