Beispiel #1
0
 /**
  * (non-PHPdoc)
  * @see BaseEntityAbstract::getJson()
  */
 public function getJson($extra = array(), $reset = false)
 {
     $class = __CLASS__;
     $array = $extra;
     if (!$this->isJsonLoaded($reset)) {
         $array['parent'] = $this->getParent() instanceof $class ? array('id' => $this->getParent()->getId()) : null;
         $array['root'] = array('id' => $this->getRoot()->getId());
         $array['namePath'] = $this->getNamePath();
         $array['noOfChildren'] = self::countByCriteria('parentId = ? and active = 1', array($this->getId()));
         $array['noOfProducts'] = Product_Category::countByCriteria('categoryId = ? and active = 1', array($this->getId()));
         $array['productAttributeSet'] = $this->getProductAttributeSet() instanceof ProductAttributeSet ? $this->getProductAttributeSet()->getJson() : null;
     }
     return parent::getJson($array, $reset);
 }