コード例 #1
0
 /**
  * @param $routePrefix
  * @param $entityName
  * @param ListViewProviderInterface $listViewProvider
  * @param AbstractType $formType
  * @param CrudManagerInterface $crudManager
  * @param string $view
  * @param array|ActionsProvider $actions
  *
  * @throws \Exception
  * @return CrudController
  */
 public function get($entityName, $routePrefix = '', ListViewProviderInterface $listViewProvider = null, AbstractType $formType = null, CrudManagerInterface $crudManager = null, $view = null, $actions = [])
 {
     $repo = $this->entityManager->getRepository($entityName);
     if ($repo === null) {
         throw new \Exception('CrudFactory: Invalid entity alias "' . $entityName . '"');
     }
     $this->securityClassPool->addClass($repo->getClassName());
     $dataProvider = new DataProvider($repo, $this->entityManager, $crudManager);
     $controller = new CrudController($dataProvider, $routePrefix, $listViewProvider, $formType, $view);
     $controller->setContainer($this->container);
     if ($actions instanceof ActionsProvider) {
         $controller->setActions($actions->getActions());
     } elseif (!empty($actions)) {
         $controller->setActions(new ArrayCollection($actions));
     } else {
         $controller->setActions($this->actions);
     }
     return $controller;
 }
コード例 #2
0
 protected function registerSupportedClass($class)
 {
     if ($this->securityClassPool) {
         $this->securityClassPool->addClass($class);
     }
 }
コード例 #3
0
ファイル: Voter.php プロジェクト: vardius/security-bundle
 /**
  * @inheritDoc
  */
 public function supports($attribute, $subject) : bool
 {
     $supportedClass = $this->classesPool->getClasses();
     $attributes = $this->typesPool->getTypes()->getKeys();
     return $subject instanceof $supportedClass && in_array($attribute, $attributes);
 }