/** * Remove internaut * * @param \BienEtreBundle\Entity\Internauts $internaut */ public function removeInternaut(\BienEtreBundle\Entity\Internauts $internaut) { $this->internaut->removeElement($internaut); }
public function load(ObjectManager $manager) { /* $tab_image = array( array( "nom" => "User/seyed.jpg", "weight" => "", "publication" => "1", "type" => "prestataire", "height" => "", "width" => "", "format" => "jpg", ), array( "nom" => "User/irina.jpg", "weight" => "", "publication" => "1", "type" => "prestataire", "height" => "", "width" => "", "format" => "jpg", ), array( "nom" => "User/virginie.jpg", "weight" => "", "publication" => "1", "type" => "prestataire", "height" => "", "width" => "", "format" => "jpg", ), array( "nom" => "User/johan.jpg", "weight" => "", "publication" => "1", "type" => "prestataire", "height" => "", "width" => "", "format" => "jpg", ), array( "nom" => "Categorie/pedicure.jpg", "weight" => "", "publication" => "1", "type" => "categorie", "height" => "", "width" => "", "format" => "jpg" ), array( "nom" => "Categorie/manicure.jpg", "weight" => "", "publication" => "1", "type" => "categorie", "height" => "", "width" => "", "format" => "jpg" ), array( "nom" => "Categorie/solarium.jpg", "weight" => "", "publication" => "1", "type" => "categorie", "height" => "", "width" => "", "format" => "jpg" ), array( "nom" => "Categorie/epilation.jpg", "weight" => "", "publication" => "1", "type" => "categorie", "height" => "", "width" => "", "format" => "jpg" ), array( "nom" => "Slider/sld1.jpg", "weight" => "", "publication" => "1", "type" => "slider", "height" => "", "width" => "", "format" => "jpg" ), array( "nom" => "Slider/sld2.jpg", "weight" => "", "publication" => "1", "type" => "slider", "height" => "", "width" => "", "format" => "jpg" ), array( "nom" => "Slider/sld3.jpg", "weight" => "", "publication" => "1", "type" => "slider", "height" => "", "width" => "", "format" => "jpg" ) ); for ($i = 0; $i < sizeof($tab_image); $i++) { $image = new Images(); $image->setNom($tab_image[$i]['nom']); $image->setWeight($tab_image[$i]['weight']); $image->setPublication($tab_image[$i]['publication']); $image->setFormat($tab_image[$i]['format']); $image->setType($tab_image[$i]['type']); $image->setHeight($tab_image[$i]['height']); $image->setWidth($tab_image[$i]['width']); $manager->persist($image); $this->addReference("image" . $i, $image); }*/ $tab_prestataire = array(array("codePostal" => $this->getReference("code_postale1"), "localite" => $this->getReference("localite1"), "commune" => $this->getReference("commune1"), "bloc" => $this->getReference("bloc1"), "nom" => "kalantarian", "prenom" => "seyed", "email" => "*****@*****.**", "numTel" => "0485/96366", "adresRue" => "Rue ferdinand nicolay", "adresNum" => "67", "password" => "", "numEssaiInfecteuse" => "4", "banni" => "0", "inscripConfig" => "0"), array("codePostal" => $this->getReference("code_postale2"), "localite" => $this->getReference("localite2"), "commune" => $this->getReference("commune2"), "bloc" => $this->getReference("bloc2"), "nom" => "tamp", "prenom" => "irina", "email" => "*****@*****.**", "numTel" => "0444/96366", "adresRue" => "Rue ferdinand desseur", "adresNum" => "6", "password" => "", "numEssaiInfecteuse" => "4", "banni" => "0", "inscripConfig" => "0"), array("codePostal" => $this->getReference("code_postale2"), "localite" => $this->getReference("localite2"), "commune" => $this->getReference("commune2"), "bloc" => $this->getReference("bloc2"), "nom" => "ali", "prenom" => "virginie", "email" => "*****@*****.**", "numTel" => "0444/124569", "adresRue" => "Rue ferdinand florence", "adresNum" => "6", "password" => "", "numEssaiInfecteuse" => "4", "banni" => "0", "inscripConfig" => "0"), array("codePostal" => $this->getReference("code_postale2"), "localite" => $this->getReference("localite2"), "commune" => $this->getReference("commune2"), "bloc" => $this->getReference("bloc2"), "nom" => "denis", "prenom" => "joan", "email" => "*****@*****.**", "numTel" => "0444/654689", "adresRue" => "Rue ferdinand dupiroux", "adresNum" => "9", "password" => "", "numEssaiInfecteuse" => "4", "banni" => "0", "inscripConfig" => "0")); for ($i = 0; $i < count($tab_prestataire); $i++) { $prestataire = new Prestataires(); $prestataire->setUsername($tab_prestataire[$i]['nom']); $prestataire->setPrenom($tab_prestataire[$i]['prenom']); $prestataire->setEmail($tab_prestataire[$i]['email']); $prestataire->setPassword($tab_prestataire[$i]['password']); $prestataire->setNumTel($tab_prestataire[$i]['numTel']); $prestataire->setInscripConfig($tab_prestataire[$i]['inscripConfig']); $prestataire->setNumEssaiInfecteuse($tab_prestataire[$i]["numEssaiInfecteuse"]); $prestataire->setEnabled($tab_prestataire[$i]["banni"]); $prestataire->setCodePostal($tab_prestataire[$i]['codePostal']); $prestataire->setLocalite($tab_prestataire[$i]['localite']); $prestataire->setCommune($tab_prestataire[$i]['commune']); $prestataire->addBloc($tab_prestataire[$i]['bloc']); $prestataire->setAdresRue($tab_prestataire[$i]['adresRue']); $prestataire->setAdresNum($tab_prestataire[$i]['adresNum']); // $prestataire->addImage($this->getReference('image'. rand(0, count($tab_image)-1))); $manager->persist($prestataire); $this->addReference("prestataire" . $i, $prestataire); } $tab_internaut = array(array("codePostal" => $this->getReference("code_postale1"), "localite" => $this->getReference("localite1"), "commune" => $this->getReference("commune1"), "bloc" => $this->getReference("bloc1"), "nom" => "kalant", "prenom" => "sed", "email" => "*****@*****.**", "numTel" => "0485/95566", "adresRue" => "Rue ferdinand nicolay", "adresNum" => "67", "password" => "", "numEssaiInfecteuse" => "4", "banni" => "0", "inscripConfig" => "0"), array("codePostal" => $this->getReference("code_postale2"), "localite" => $this->getReference("localite2"), "commune" => $this->getReference("commune2"), "bloc" => $this->getReference("bloc2"), "nom" => "tmp", "prenom" => "iri", "email" => "*****@*****.**", "numTel" => "0444/55366", "adresRue" => "Rue fernand desseur", "adresNum" => "6", "password" => "", "numEssaiInfecteuse" => "4", "banni" => "0", "inscripConfig" => "0"), array("codePostal" => $this->getReference("code_postale2"), "localite" => $this->getReference("localite2"), "commune" => $this->getReference("commune2"), "bloc" => $this->getReference("bloc2"), "nom" => "alinsson", "prenom" => "virgie", "email" => "*****@*****.**", "numTel" => "0444/554569", "adresRue" => "Rue fernand florence", "adresNum" => "6", "password" => "", "numEssaiInfecteuse" => "4", "banni" => "0", "inscripConfig" => "0"), array("codePostal" => $this->getReference("code_postale2"), "localite" => $this->getReference("localite2"), "commune" => $this->getReference("commune2"), "bloc" => $this->getReference("bloc2"), "nom" => "ann", "prenom" => "ghoan", "email" => "*****@*****.**", "numTel" => "0444/554229", "adresRue" => "Rue fernand dupiroux", "adresNum" => "9", "password" => "", "numEssaiInfecteuse" => "4", "banni" => "0", "inscripConfig" => "0")); for ($i = 0; $i < count($tab_internaut); $i++) { $internaut = new Internauts(); $internaut->setUsername($tab_internaut[$i]['nom']); $internaut->setPrenom($tab_internaut[$i]['prenom']); $internaut->setEmail($tab_internaut[$i]['email']); $internaut->setPassword($tab_internaut[$i]['password']); $internaut->setNumTel($tab_internaut[$i]['numTel']); $internaut->setInscripConfig($tab_internaut[$i]['inscripConfig']); $internaut->setNumEssaiInfecteuse($tab_internaut[$i]["numEssaiInfecteuse"]); $internaut->setEnabled($tab_internaut[$i]["banni"]); $internaut->setCodePostal($tab_internaut[$i]['codePostal']); $internaut->setLocalite($tab_internaut[$i]['localite']); $internaut->setCommune($tab_internaut[$i]['commune']); $internaut->addBloc($tab_internaut[$i]['bloc']); $internaut->setAdresRue($tab_internaut[$i]['adresRue']); $internaut->setAdresNum($tab_internaut[$i]['adresNum']); //$internaut->addImage($this->getReference('image'. rand(0, count($tab_image)-1))); $manager->persist($internaut); $this->addReference("internaut" . $i, $internaut); } /* for($i=0; $i < count($tab_image)&&$i<4; $i++){ $image = $this->getReference("image".$i); $image->setUser($this->getReference('prestataire'.$i)); $manager->persist($image); }*/ $manager->flush(); }