Пример #1
0
 public function load(ObjectManager $manager)
 {
     for ($i = 0; $i < 10; $i++) {
         $student = new Rating();
         $student->setMon(rand(1, 5));
         $student->setTue(rand(1, 5));
         $student->setWed(rand(1, 5));
         $student->setThu(rand(1, 5));
         $student->setFri(rand(1, 5));
         $student->setSat(rand(1, 5));
     }
     $manager->flush();
 }
Пример #2
0
 /**
  *
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $rate = new Rating();
     $rate->setText("When bad is really bad");
     $manager->persist($rate);
     $rate = new Rating();
     $rate->setText("Better than network TV");
     $manager->persist($rate);
     $rate = new Rating();
     $rate->setText("Laughs here and there");
     $manager->persist($rate);
     $rate = new Rating();
     $rate->setText("Borderline genius");
     $manager->persist($rate);
     $rate = new Rating();
     $rate->setText("Sublime in every way");
     $manager->persist($rate);
     $manager->flush();
     // ---------------------------------------------
     $s = new Source();
     $s->setName("MST3K");
     $manager->persist($s);
     $s = new Source();
     $s->setName("RiffTrax");
     $manager->persist($s);
     $manager->flush();
     // ---------------------------------------------
     $s1 = $manager->find('\\AppBundle\\Entity\\Source', 1);
     $s2 = $manager->find('\\AppBundle\\Entity\\Source', 2);
     $r = new Riff();
     $r->setTitle('Catalina Caper');
     $r->setSource($s1);
     $r->setRating($manager->find('\\AppBundle\\Entity\\Rating', 4));
     $manager->persist($r);
     $r = new Riff();
     $r->setTitle('The Amazing Colossal Man');
     $r->setSource($s1);
     $r->setRating($manager->find('\\AppBundle\\Entity\\Rating', 4));
     $manager->persist($r);
     $r = new Riff();
     $r->setTitle('Daddy-O');
     $r->setSource($s1);
     $r->setRating($manager->find('\\AppBundle\\Entity\\Rating', 3));
     $manager->persist($r);
     $r = new Riff();
     $r->setTitle('Pod People');
     $r->setSource($s1);
     $r->setRating($manager->find('\\AppBundle\\Entity\\Rating', 4));
     $manager->persist($r);
     $r = new Riff();
     $r->setTitle('Mitchell');
     $r->setSource($s1);
     $r->setRating($manager->find('\\AppBundle\\Entity\\Rating', 5));
     $manager->persist($r);
     $r = new Riff();
     $r->setTitle('Cave Dwellers');
     $r->setSource($s1);
     $r->setRating($manager->find('\\AppBundle\\Entity\\Rating', 3));
     $manager->persist($r);
     $r = new Riff();
     $r->setTitle('Being from Another Planet');
     $r->setSource($s1);
     $r->setRating($manager->find('\\AppBundle\\Entity\\Rating', 4));
     $manager->persist($r);
     $r = new Riff();
     $r->setTitle('Stranded in Space');
     $r->setSource($s1);
     $r->setRating($manager->find('\\AppBundle\\Entity\\Rating', 5));
     $manager->persist($r);
     $r = new Riff();
     $r->setTitle('Time of the Apes');
     $r->setSource($s1);
     $r->setRating($manager->find('\\AppBundle\\Entity\\Rating', 1));
     $manager->persist($r);
     $r = new Riff();
     $r->setTitle('Gamera vs. Gaos');
     $r->setSource($s1);
     $r->setRating($manager->find('\\AppBundle\\Entity\\Rating', 4));
     $manager->persist($r);
     $r = new Riff();
     $r->setTitle('Radical Jack');
     $r->setSource($s2);
     $r->setRating($manager->find('\\AppBundle\\Entity\\Rating', 5));
     $manager->persist($r);
     $r = new Riff();
     $r->setTitle('Planet of the Dinosaurs');
     $r->setSource($s2);
     $r->setRating($manager->find('\\AppBundle\\Entity\\Rating', 5));
     $manager->persist($r);
     $r = new Riff();
     $r->setTitle('The Incredible 2 Headed Transplant');
     $r->setSource($s2);
     $r->setRating($manager->find('\\AppBundle\\Entity\\Rating', 5));
     $manager->persist($r);
     $r = new Riff();
     $r->setTitle('Hawk the Slayer');
     $r->setSource($s2);
     $r->setRating($manager->find('\\AppBundle\\Entity\\Rating', 3));
     $manager->persist($r);
     $r = new Riff();
     $r->setTitle('DinoSaurus');
     $r->setSource($s2);
     $r->setRating($manager->find('\\AppBundle\\Entity\\Rating', 2));
     $manager->persist($r);
     $r = new Riff();
     $r->setTitle('The City of the Dead');
     $r->setSource($s2);
     $r->setRating($manager->find('\\AppBundle\\Entity\\Rating', 3));
     $manager->persist($r);
     $r = new Riff();
     $r->setTitle('The Last Slumber Party');
     $r->setSource($s2);
     $r->setRating($manager->find('\\AppBundle\\Entity\\Rating', 3));
     $manager->persist($r);
     $manager->flush();
 }