Esempio n. 1
0
 /**
  * Load data to database.
  *
  * @param ObjectManager $em Doctrine entity manager
  */
 public function load(ObjectManager $em)
 {
     $defaultContext = $this->getReference('default-context');
     $collection = new Collection();
     $collection->setContext($defaultContext);
     $collection->setEnabled(true);
     $collection->setName('Concours');
     $collection->setDescription('Dans cette collection, on associe tous les types de concours.');
     $em->persist($collection);
     $em->flush();
 }
 /**
  * Load data to database.
  *
  * @param ObjectManager $em Doctrine entity manager
  */
 public function load(ObjectManager $em)
 {
     //On ajoute des données que dans les environnements de tests et de dev
     if (!in_array($this->container->get('kernel')->getEnvironment(), array('test', 'dev'))) {
         return;
     }
     $collection1 = new Collection();
     $collection1->setEnabled(true);
     $collection1->setName('Collection RP');
     $collection1->setDescription('Collection de RPs');
     $collection1->setContext($this->getReference('context-rp'));
     $em->persist($collection1);
     $collection2 = new Collection();
     $collection2->setEnabled(true);
     $collection2->setName('Collection Personnage');
     $collection2->setDescription('Collection de Personnages');
     $collection2->setContext($this->getReference('context-personnages'));
     $em->persist($collection2);
     $em->flush();
     $this->addReference('collection-rp', $collection1);
     $this->addReference('collection-personnage', $collection2);
 }