Esempio n. 1
0
 public function load(ObjectManager $manager)
 {
     $names = array('Gianni', 'Luca', 'Paolo', 'Marco', 'Giorgio', 'Anna', 'Carla', 'Sofia', 'Lisa', 'Ida');
     $last_names = array('Orange', 'Brown', 'White', 'Grey', 'Red', 'Yellow', 'Violet', 'Green', 'Blue', 'Purple');
     $student_numbers = array('32456', '47201', '09564', '12544', '77532', '32564', '83221', '39765', '43760', '21654');
     $emails = array('*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**');
     $passwords = array('orange', 'brown', 'white', 'grey', 'red', 'yellow', 'violet', 'green', 'blue', 'purple');
     for ($i = 0; $i < 10; $i++) {
         $student = new Student();
         $student->setName($names[$i]);
         $student->setLastName($last_names[$i]);
         $student->setStudentNumber($student_numbers[$i]);
         $student->setEmail($emails[$i]);
         $student->setPassword($passwords[$i]);
         //codificare
         $student->setCoins(10);
         $student->setStatus(1);
         $student->setSubscriptionDate(new \DateTime());
         $manager->persist($student);
         $manager->flush();
     }
 }
 /**
  * {@inheritDoc}
  */
 public function __toString()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, '__toString', array());
     return parent::__toString();
 }