예제 #1
0
 public function createNode($name)
 {
     $node = new Category();
     $node->setLocale('en');
     $node->setDescription('');
     $node->setMetaUrl('/');
     $node->setTitle($name);
     $this->em->persist($node);
     $this->em->flush();
     return $node;
 }
예제 #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);
             foreach ($XML->database->table as $table) {
                 $category = new Category();
                 $category->setLocale($table->column[1]);
                 $category->setTitle($table->column[3]);
                 $category->setDescription($table->column[8]);
                 $category->setStatus($table->column[9]);
                 $category->setMetaUrl($table->column[10]);
                 if ($table->column[2] != 'NULL') {
                     $rootCategory = $this->getReference('product_category_' . $table->column[2]);
                     $category->setParent($rootCategory);
                 }
                 $manager->persist($category);
                 $manager->flush();
                 $this->addReference('product_category_' . $table->column[0], $category);
             }
         }
     }
 }