示例#1
0
 /**
  * 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;
     }
     $mots = explode(',', 'érotique,violent,normal,libre,privé,terminé,en cours');
     foreach ($mots as $mot) {
         $tag = new Tag();
         $tag->setEnabled(true);
         $tag->setContext($this->getReference('context-rp'));
         $tag->setName($mot);
         $em->persist($tag);
         $this->addReference("tag-{$mot}", $tag);
     }
     $em->flush();
 }
示例#2
0
 /**
  * Load data to database.
  *
  * @param ObjectManager $em Doctrine entity manager
  */
 public function load(ObjectManager $em)
 {
     //Dictionary Cooking
     $mots = 'érotique,fantastique,contemporain,historique,futuriste,apocalyptique,avatars réels,avatar manga,city,université';
     $mots .= ',harry potter,ange,démon,vampire,lycanthrope';
     $mots = explode(',', $mots);
     natsort($mots);
     /** @var Context $context */
     $context = $this->getReference('site-context');
     foreach ($mots as $mot) {
         $tag = new Tag();
         $tag->setEnabled(true);
         $tag->setContext($context);
         $tag->setName($mot);
         $em->persist($tag);
         $this->addReference("tag-{$mot}", $tag);
     }
     unset($mots);
     $em->flush();
 }