예제 #1
0
 /**
  * @param \Symfony\Component\HttpFoundation\Request $request
  * @param \Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter $configuration
  * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
  * @return bool|void
  */
 public function apply(Request $request, ParamConverter $configuration)
 {
     $param = $configuration->getName();
     $alias = $request->attributes->get('alias');
     if (!$request->attributes->has('alias')) {
         throw new NotFoundHttpException('Cannot find admin without alias');
     }
     try {
         $admin = $this->adminManager->getAdmin($alias);
         $request->attributes->set($param, $admin);
         $this->registry->addActivePath($admin->getDefaultPath());
     } catch (\InvalidArgumentException $e) {
         throw new NotFoundHttpException(sprintf('Cannot find admin with alias "%s"', $alias));
     }
 }
예제 #2
0
 /**
  * Add a path to be considered as active (navigation-wise)
  *
  * @param array $paths an array of URI paths
  */
 public function addActivePath($path)
 {
     $this->registry->addActivePath($path);
 }