private function updateBundleRoutes(ControllerSpec $spec)
 {
     $bundle = $spec->getBundle();
     $bundleRoutingFile = $bundle->getPath() . '/Resources/config/routing.yml';
     if (!realpath($bundleRoutingFile)) {
         return false;
     }
     $routing = Yaml::parse(file_get_contents($bundleRoutingFile));
     $prefix = strtolower($spec->getName());
     foreach ($spec->getActions() as $action) {
         $key = $prefix . '_' . strtolower($action);
         $routing[$key] = array('path' => '/' . $action, 'defaults' => array('_controller' => $bundle->getName() . ':' . $spec->getName() . ':' . $action));
     }
     file_put_contents($bundleRoutingFile, Yaml::dump($routing));
 }
 /**
  * @param ControllerSpec $spec
  * @return \PhpParser\Node[]
  */
 private function doGenerate(ControllerSpec $spec)
 {
     $factory = new \PhpParser\BuilderFactory();
     $stmts = array();
     $stmts[] = $factory->namespace(array($spec->getBundle()->getNamespace(), 'Controller'));
     $class = $factory->class($spec->getName() . 'Controller');
     if ($spec->getBaseClass()) {
         $stmts[] = $factory->use($spec->getBaseClass());
         $class->extend(new Name(array_slice($spec->getBaseClass(), -1, 1)));
         if ($spec->getOptions()->isStrictOOP()) {
             $class->makeFinal();
         }
     }
     foreach ($spec->getActions() as $action) {
         $class->addStmt($factory->method($action . 'Action'));
     }
     $stmts[] = $class;
     $nodes = array_map(function ($stmt) {
         return $stmt->getNode();
     }, $stmts);
     return $nodes;
 }