Exemplo n.º 1
0
 public function load(ObjectManager $manager)
 {
     $tab_promotion = array(array("nom" => "promotion1", "description" => "description promotion1", "debut" => new \DateTime("12-10-2019"), "fin" => new \DateTime("21-10-2019"), "affichageDe" => new \DateTime("01-10-2015"), "affichageJusque" => new \DateTime("30-10-2015")), array("nom" => "promotion2", "description" => "description promotion2", "debut" => new \DateTime("12-11-1999"), "fin" => new \DateTime("21-11-1999"), "affichageDe" => new \DateTime("01-11-2015"), "affichageJusque" => new \DateTime("30-11-2015")), array("nom" => "promotion3", "description" => "description promotion3", "debut" => new \DateTime("12-12-2019"), "fin" => new \DateTime("21-10-2019"), "affichageDe" => new \DateTime("01-12-2015"), "affichageJusque" => new \DateTime("30-12-2015")), array("nom" => "promotion4", "description" => "description promotion4", "debut" => new \DateTime("12-1-1999"), "fin" => new \DateTime("21-1-1999"), "affichageDe" => new \DateTime("01-01-2015"), "affichageJusque" => new \DateTime("30-01-2015")));
     for ($i = 0; $i < sizeof($tab_promotion); $i++) {
         $promotion = new Promotions();
         $promotion->setNom($tab_promotion[$i]['nom']);
         $promotion->setDescription($tab_promotion[$i]['description']);
         $promotion->setDebut($tab_promotion[$i]['debut']);
         $promotion->setFin($tab_promotion[$i]['fin']);
         $promotion->setAffichageDe($tab_promotion[$i]['affichageDe']);
         $promotion->setAffichageJusque($tab_promotion[$i]['affichageJusque']);
         $promotion->setPrestataire($this->getReference("prestataire" . $i));
         $manager->persist($promotion);
     }
     $manager->flush();
 }
Exemplo n.º 2
0
 /**
  * Remove promotion
  *
  * @param \BienEtreBundle\Entity\Promotions $promotion
  */
 public function removePromotion(\BienEtreBundle\Entity\Promotions $promotion)
 {
     $this->promotion->removeElement($promotion);
 }