コード例 #1
0
 /**
  * @Route("/{slug}/{locale}", name="icap_badge_badge_collection_share_view", defaults={"locale"= "fr"})
  * @Template
  */
 public function shareViewAction(Request $request, BadgeCollection $collection, $locale)
 {
     $request->setLocale($locale);
     if (!$collection->isIsShared()) {
         throw $this->createNotFoundException('Collection not shared.');
     }
     if (!$this->container->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_FULLY')) {
         $showBanner = false;
     } else {
         $showBanner = $this->getUser() === $collection->getUser();
     }
     return array('collection' => $collection, 'user' => $collection->getUser(), 'showBanner' => $showBanner);
 }