public function generate() { /** * @var \Doctrine\Common\Annotations\FileCacheReader */ $reader = $this->admin->getService('annotation_reader'); if ($this->controller) { $rc = new \ReflectionClass($this->controller); foreach ($rc->getMethods() as $m) { if ($m instanceof \ReflectionMethod) { if ($m->isAbstract() || $m->isAbstract() || $m->isConstructor() || $m->isDestructor() || $m->isStatic()) { continue; } $_as = $reader->getMethodAnnotations($m); $as = array(); foreach ($_as as $annot) { $_class = get_class($annot); if (isset($as[$_class])) { if (is_array($as[$_class])) { $as[$_class][] = $annot; } else { $as[$_class] = array($as[$_class], $annot); } } else { $as[$_class] = $annot; } } if (!isset($as[self::ROUTE_ANNOT_CLASS])) { continue; } if (isset($as[self::SYMFONY_ROUTE_ANNOT_CLASS])) { throw new \Exception(sprintf("%s (AdminRoute, SymfonyRoute) duplicate ", $this->err_msg)); } $annot = $as[self::ROUTE_ANNOT_CLASS]; if ($this->addRoute($m, $annot, $as)) { $this->page_loader->addFileResource($rc->getFileName()); } } } } }