Esempio n. 1
0
 public function enforceOwnerSecurity(Area $area)
 {
     $user = $this->getUser();
     if ($user != $area->GetOwner()) {
         throw new AccessDeniedException('You need to be the owner.');
     }
 }
Esempio n. 2
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $user = $manager->getRepository('UserBundle:User')->loadUserByUsername('adamkempo');
     $area1 = new Area();
     $area1->setName('Nagymaros Vegymu');
     $area1->setLocation('Nagymaros');
     $area1->setDate(new \DateTime('tomorrow noon'));
     $area1->setDetails('Ez a legnagyobb a kornyeken');
     $manager->persist($area1);
     $area2 = new Area();
     $area2->setName('Kismaros Egeto');
     $area2->setLocation('Kismaros');
     $area2->setDate(new \DateTime('today noon'));
     $area2->setDetails('Ez a legszebb a kornyeken');
     $manager->persist($area2);
     /*        $area1->setOwner($user);
             $area2->setOwner($user);*/
     $manager->flush();
 }