Ejemplo n.º 1
0
 public function load(ObjectManager $em)
 {
     for ($i = 1; $i <= 10; $i++) {
         $qcm = new Qcm();
         $qcm->setName('Qcm ' . $i . ' en histoire');
         $qcm->setDuration(100000);
         $qcm->setCreateBy($em->merge($this->getReference('user1')));
         $qcm->setCategory($em->merge($this->getReference('category-histoire')));
         $em->persist($qcm);
         $this->addReference('qcm-histoire-' . $i, $qcm);
     }
     for ($i = 1; $i <= 10; $i++) {
         $qcm = new Qcm();
         $qcm->setName('Qcm ' . $i . ' en maths');
         $qcm->setDuration(100000);
         $qcm->setCreateBy($em->merge($this->getReference('user1')));
         $qcm->setCategory($em->merge($this->getReference('category-maths')));
         $em->persist($qcm);
         $this->addReference('qcm-maths-' . $i, $qcm);
     }
     for ($i = 1; $i <= 10; $i++) {
         $qcm = new Qcm();
         $qcm->setName('Qcm ' . $i . ' en francais');
         $qcm->setDuration(100000);
         $qcm->setCreateBy($em->merge($this->getReference('user1')));
         $qcm->setCategory($em->merge($this->getReference('category-francais')));
         $em->persist($qcm);
         $this->addReference('qcm-francais-' . $i, $qcm);
     }
     for ($i = 1; $i <= 10; $i++) {
         $qcm = new Qcm();
         $qcm->setName('Qcm ' . $i . ' en physique');
         $qcm->setDuration(100000);
         $qcm->setCreateBy($em->merge($this->getReference('user1')));
         $qcm->setCategory($em->merge($this->getReference('category-physique')));
         $em->persist($qcm);
         $this->addReference('qcm-physique-' . $i, $qcm);
     }
     for ($i = 1; $i <= 10; $i++) {
         $qcm = new Qcm();
         $qcm->setName('Qcm ' . $i . ' en dessin');
         $qcm->setDuration(100000);
         $qcm->setCreateBy($em->merge($this->getReference('user1')));
         $qcm->setCategory($em->merge($this->getReference('category-dessin')));
         $em->persist($qcm);
         $this->addReference('qcm-dessin-' . $i, $qcm);
     }
     $em->flush();
 }
Ejemplo n.º 2
0
 /**
  * @VirtualProperty
  * @SerializedName ("qcm_id")
  *
  * @return string
  */
 public function get_qcm_id()
 {
     return $this->qcm->getId();
 }