public function load(ObjectManager $manager) { $lesPeriodes = array(array('classe_reference' => 'sio2', 'dateDebut' => new \DateTime('2016-01-11'), 'dateFin' => new \DateTime('2016-03-04'), 'reference' => 'periode_sio2_1')); foreach ($lesPeriodes as $unePeriode) { $anneeUniversitaire = $this->container->get('easystage_app.anneuniversitaire'); $periodestage = new PeriodeStage($anneeUniversitaire->getAnneeUniversitaire()); $periodestage->setClasse($manager->merge($this->getReference($unePeriode['classe_reference']))); $periodestage->setDateDebut($unePeriode['dateDebut']); $periodestage->setDateFin($unePeriode['dateFin']); $manager->persist($periodestage); $this->addReference($unePeriode['reference'], $periodestage); } $manager->flush(); }
/** * {@inheritDoc} */ public function setDateDebut($dateDebut) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'setDateDebut', [$dateDebut]); return parent::setDateDebut($dateDebut); }