Ejemplo n.º 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();
 }
Ejemplo n.º 2
0
 public function load(ObjectManager $manager)
 {
     $names = array('Kill Bill', 'Jurassic Park', 'Star Wars', 'Star Trek', 'Rock n Rolla', 'La Cite des Anges', 'Gravity', 'Avengers', 'Denver', 'Alien');
     $director = array("Stephen King", "Jean-Pierre Foucault", "Cyril Hanouna", "Piotr Gueye", "Valérie Dubois", "Jean-Michel Maire", "Enora Malagré", "Julien Courbet", "Isabelle Bosc", "Issa Doumbia");
     $i = 0;
     foreach ($names as $name) {
         $movie = new Movie();
         $movie->setName($name);
         $movie->setDate(new \DateTime());
         $movie->setDirector($director[$i]);
         $manager->persist($movie);
         $i++;
     }
     $manager->flush();
 }
 /**
  * {@inheritDoc}
  */
 public function getSlug()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getSlug', array());
     return parent::getSlug();
 }