/** * Set config data for current Document & locale * * @param string $locale * @param string $document * @param string $value * * @throws \RuntimeException */ public function setConfig($locale, $document, $value) { $config = $this->getConfig($locale, $document); if (!$config) { $config = new Config(); } try { $config->setlocale($locale); $config->setEntity($document); $config->setValue(json_encode($value)); $this->getDocumentManager()->persist($config); $this->getDocumentManager()->flush(); } catch (\Exception $e) { throw new \RuntimeException($e); } }
/** * {@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(); } } } }