public function load(ObjectManager $manager) { $tab_commentaires = array(array("titre" => "Solarium", "description" => "Tous les soins des solariums", "date" => new \DateTime("21-12-2015")), array("titre" => "Manicure", "description" => "Tous les soins des main", "date" => new \DateTime("30-10-2015")), array("titre" => "Epilation", "description" => "Enlevez poils", "date" => new \DateTime("3-1-2015")), array("titre" => "Pedicure", "description" => "Tous les soins des pieds", "date" => new \DateTime("16-11-2015"))); for ($i = 0; $i < count($tab_commentaires); $i++) { $commentaire = new Commentaires(); $commentaire->setTitre($tab_commentaires[$i]['titre']); $commentaire->setDescription($tab_commentaires[$i]['description']); $commentaire->setDate($tab_commentaires[$i]['date']); $commentaire->setInternaut($this->getReference('internaut' . $i)); $commentaire->setPrestataire($this->getReference('prestataire' . $i)); $manager->persist($commentaire); $this->addReference("commentaire" . $i, $commentaire); } $manager->flush(); }
/** * Remove commentaire * * @param \BienEtreBundle\Entity\Commentaires $commentaire */ public function removeCommentaire(\BienEtreBundle\Entity\Commentaires $commentaire) { $this->commentaire->removeElement($commentaire); }