private function validateOwner(\Club\ShopBundle\Entity\Subscription $subscription)
 {
     $user = $this->get('security.context')->getToken()->getUser();
     // FIXME, does security not allowed exception exists
     if ($subscription->getUser()->getId() != $user->getId()) {
         throw new \Exception('You are not allowed to change this subscription.');
     }
 }
示例#2
0
 private function getAttributeQuery(\Club\ShopBundle\Entity\Subscription $subscription, $attribute_name)
 {
     return $this->_em->createQueryBuilder()->select('sa')->from('ClubShopBundle:SubscriptionAttribute', 'sa')->where('sa.subscription = :subscription')->andWhere('sa.attribute_name = :attribute')->setParameter('subscription', $subscription->getId())->setParameter('attribute', $attribute_name);
 }