/** * @param Zend_Db_Table_Rowset $row * @param Catalog_Model_SubproductParams $entry * @return Catalog_Model_SubproductParams */ public function _setDbData($row, Catalog_Model_SubproductParams $entry) { $info = $this->getDbTable()->info(); $properties = $info['cols']; foreach ($properties as $property) { $entry->__set($this->_normaliseName($property), $row->{$property}); } return $entry; }
/** * @param $subproductProperty * @return Catalog_Model_SubproductParams */ public function newSubproductProperty(&$subproductProperty) { $subproductParams = new Catalog_Model_SubproductParams(); $subproductParamsOrder = $subproductProperty['order'] && $subproductProperty['order'] != '' ? $subproductProperty['order'] : 0; $subproductParams->setProductId($subproductProperty['productId'])->setName($subproductProperty['name'])->setOrder($subproductParamsOrder); $this->_subproductsParamsMapper->save($subproductParams); $id = $this->_subproductsParamsMapper->getDbTable()->getAdapter()->lastInsertId(); $subproductParams->setId($id); $modifications = $this->_subproductsModelMapper->fetchAll($this->_subproductsModelMapper->getDbTable()->select()->where('parent_id = ?', $subproductProperty['productId'])); if (!empty($modifications)) { foreach ($modifications as $modification) { $subproductParamsValue = new Catalog_Model_SubproductParamsValues(); $subproductParamsValue->setParamId($id)->setSubproductId($modification->getId())->setValue('-'); $this->_subproductParamsValuesMapper->save($subproductParamsValue); } } return $subproductParams; }