Пример #1
0
 public function load(ObjectManager $manager)
 {
     $names1 = array('Assane', 'Piotr', 'Julien', 'Cyril');
     $names2 = array("Gueye", "Lawniczak", "leclerc", "Hanouna");
     $mails = array('*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**');
     $logins = array('assane1', 'piotr401', 'julien34', 'cyril666');
     $pass = array('1234', '4321', '3214', '1111');
     $movie = new Movie();
     $movie->setName('One punch man');
     $movie->setDate(new \DateTime());
     $movie->setDirector('Peter Pan');
     $i = 0;
     foreach ($names1 as $name) {
         $user = new User();
         $user->setName($name);
         $user->setFamilyName($names2[$i]);
         $user->setLogin($logins[$i]);
         $user->setEmail($mails[$i]);
         $user->setPassw($pass[$i]);
         $user->setBestMovie($movie);
         $manager->persist($user);
         $i++;
     }
     $manager->flush();
 }
 /**
  * {@inheritDoc}
  */
 public function setName($name)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'setName', array($name));
     return parent::setName($name);
 }