示例#1
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $wayne = $manager->getRepository('UserBundle:User')->findOneByUsernameOrEmail('wayne');
     $event1 = new Email();
     $event1->setName('Daphne coming soon');
     $event1->setLocation('punta cana, Dominican Republic');
     $event1->setTime(new \DateTime('tomorrow noon'));
     $event1->setDetails('She is coming for the very first time to visit us');
     $manager->persist($event1);
     $event2 = new Email();
     $event2->setName('Eddy is going to Succeed!');
     $event2->setLocation('brandenburg gate berlin, germany');
     $event2->setTime(new \DateTime('tomorrow noon'));
     $event2->setDetails('I\'m going to Win!');
     $manager->persist($event2);
     $event1->setOwner($wayne);
     $event2->setOwner($wayne);
     $manager->flush();
 }
示例#2
0
 private function enforceOwnerSecurity(Email $email)
 {
     $user = $this->getUser();
     if ($user != $email->getOwner()) {
         throw new AccessDeniedException('You are not the owner!');
     }
 }