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 getBestMovie() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getBestMovie', array()); return parent::getBestMovie(); }