/** * * @return string */ public function showComponents() { $html = ''; foreach (KitComponent::getAllByCriteria('kitId=?', array($this->kit->getId())) as $index => $kitComponent) { $html .= $this->getRow($kitComponent->getQty(), $kitComponent->getComponent()->getSku(), $kitComponent->getComponent()->getName(), 'itemRow'); } return $html; }
/** * (non-PHPdoc) * @see BaseEntityAbstract::getJson() */ public function getJson($extra = array(), $reset = false) { $array = $extra; if (!$this->isJsonLoaded($reset)) { $array['task'] = $this->getTask() instanceof Task ? $this->getTask()->getJson() : null; $array['product'] = $this->getProduct() instanceof Product ? $this->getProduct()->getJson() : null; $array['soldToCustomer'] = $this->getSoldToCustomer() instanceof Customer ? $this->getSoldToCustomer()->getJson() : null; $array['soldOnOrder'] = $this->getSoldOnOrder() instanceof Order ? $this->getSoldOnOrder()->getJson() : null; $array['shippment'] = $this->getShippment() instanceof Shippment ? $this->getShippment()->getJson() : null; $array['components'] = array_map(create_function('$a', 'return $a->getJson();'), KitComponent::getAllByCriteria('kitId = ?', array($this->getId()))); } return parent::getJson($array, $reset); }