示例#1
0
 public function findOr404(RequestConfiguration $configuration)
 {
     $request = $configuration->getRequest();
     if ($request->attributes->has('_page')) {
         $page = $request->attributes->get('_page');
         if ($page->getId() !== null) {
             return $page;
         }
     }
     return parent::findOr404($configuration);
 }
示例#2
0
 public function createNew()
 {
     // Get gallery item
     $galleryItem = parent::createNew();
     $galleryId = $this->getRequest()->get('gallery_id');
     $galleryRepository = $this->container->get('symedit.repository.image_gallery');
     $gallery = $galleryRepository->find($galleryId);
     if (!$gallery) {
         throw $this->createNotFoundException('Gallery not found');
     }
     $galleryItem->setGallery($gallery);
     return $galleryItem;
 }