Example #1
0
 /**
  * Set config data for current entity & locale
  *
  * @param string $locale
  * @param string $entity
  * @param string $value
  *
  * @throws \RuntimeException
  */
 public function setConfig($locale, $entity, $value)
 {
     $config = $this->getConfig($locale, $entity);
     if (!$config) {
         $config = new Config();
     }
     try {
         $config->setlocale($locale);
         $config->setEntity($entity);
         $config->setValue(json_encode($value));
         $this->_em->persist($config);
         $this->_em->flush();
     } catch (Exception $e) {
         throw new \RuntimeException($e);
     }
 }
Example #2
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     foreach ($this->fixtureFiles as $file) {
         if (file_exists($file)) {
             $contents = file_get_contents($file);
             $XML = simplexml_load_string($contents);
             $city = null;
             foreach ($XML->database->table as $table) {
                 $config = new Config();
                 $config->setlocale($table->column[1]);
                 $config->setEntity($table->column[2]);
                 $config->setValue($table->column[3]);
                 $manager->persist($config);
                 $manager->flush();
             }
         }
     }
 }