public function createNode($name) { $node = new Menu(); $node->setLocale('en'); $node->setMetaUrl('/'); $node->setTitle($name); $this->em->persist($node); $this->em->flush(); return $node; }
/** * {@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); foreach ($XML->database->table as $table) { $rootNode = null; if ($table->column[2] != 'NULL') { $rootNode = $this->getReference('menu_top_' . $table->column[2]); } $menu = new Menu(); $menu->setLocale($table->column[1]); $menu->setName($table->column[7]); $menu->setMetaUrl($table->column[8]); $menu->setStatus((int) $table->column[9]); if ($rootNode) { $menu->setParent($rootNode); } $manager->persist($menu); $manager->flush(); $this->addReference('menu_top_' . $table->column[0], $menu); } } } }