WellCommerce\Bundle\CategoryBundle\Entity\Category::setChildren PHP Method

setChildren() public method

public setChildren ( Doctrine\Common\Collections\Collection $children )
$children Doctrine\Common\Collections\Collection
    public function setChildren(Collection $children)
    {
        $this->children = $children;
    }

Usage Example

 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     if (!$this->isEnabled()) {
         return;
     }
     $shop = $this->getReference('shop');
     foreach (self::$samples as $hierarchy => $name) {
         $category = new Category();
         $category->setEnabled(true);
         $category->setHierarchy($hierarchy);
         $category->setParent(null);
         $category->setProducts(new ArrayCollection());
         $category->setChildren(new ArrayCollection());
         $category->setChildrenCount(0);
         $category->setProductsCount(0);
         $category->addShop($shop);
         $category->translate($this->container->getParameter('locale'))->setName($name);
         $category->translate($this->container->getParameter('locale'))->setSlug(Sluggable::makeSlug($name));
         $category->translate($this->container->getParameter('locale'))->setShortDescription('');
         $category->translate($this->container->getParameter('locale'))->setDescription('');
         $category->mergeNewTranslations();
         $manager->persist($category);
         $this->setReference('category_' . $name, $category);
     }
     $manager->flush();
 }
All Usage Examples Of WellCommerce\Bundle\CategoryBundle\Entity\Category::setChildren