コード例 #1
0
ファイル: BatchManager.php プロジェクト: enhavo/enhavo
 public function executeBatch($resources, RequestConfigurationInterface $requestConfiguration)
 {
     $type = $requestConfiguration->getBatchType();
     if ($type == null) {
         throw new NotFoundHttpException();
     }
     $options = $requestConfiguration->getBatchOptions($type);
     /** @var BatchInterface $batch */
     $batch = $this->collector->getType($type);
     $batch = clone $batch;
     $batch->setOptions($options);
     if ($batch->isGranted()) {
         $batch->execute($resources);
     } else {
         throw new AccessDeniedHttpException();
     }
 }
コード例 #2
0
ファイル: ViewerFactory.php プロジェクト: enhavo/enhavo
 public function create(RequestConfigurationInterface $configuration, MetadataInterface $metadata = null, $newResource = null, Form $form = null, $defaultType = null)
 {
     $viewerType = $configuration->getViewerType() ? $configuration->getViewerType() : $defaultType;
     /** @var ViewerInterface $viewer */
     $viewer = $this->collector->getType($viewerType);
     $viewer = clone $viewer;
     $viewer->setContainer($this->container);
     $viewer->setConfiguration($configuration);
     if ($metadata) {
         $viewer->setMetadata($metadata);
     }
     if ($form) {
         $viewer->setForm($form);
     }
     if ($newResource) {
         $viewer->setResource($newResource);
     }
     $optionAccessor = new OptionAccessor();
     $viewer->configureOptions($optionAccessor);
     $optionAccessor->resolve($configuration->getViewerOptions());
     $viewer->setOptionAccessor($optionAccessor);
     return $viewer;
 }