/**
  * @param ObjectManager $manager
  */
 public function load(ObjectManager $manager)
 {
     $title = new LocalizedFallbackValue();
     $title->setString('Master catalog');
     $category = new Category();
     $category->addTitle($title);
     $manager->persist($category);
     $manager->flush($category);
 }
 /**
  * @param Category $root
  * @param array $categories
  */
 protected function addCategories(Category $root, array $categories)
 {
     if (!$categories) {
         return;
     }
     foreach ($categories as $title => $nestedCategories) {
         $categoryTitle = new LocalizedFallbackValue();
         $categoryTitle->setString($title);
         $category = new Category();
         $category->addTitle($categoryTitle);
         $root->addChildCategory($category);
         $this->addCategories($category, $nestedCategories);
     }
 }
Example #3
0
 public function testToString()
 {
     $value = 'test';
     $title = new LocalizedFallbackValue();
     $title->setString($value);
     $category = new Category();
     $category->addTitle($title);
     $this->assertEquals($value, (string) $category);
 }