/** * @return \Application\Model\Bean\ProductCostLog */ private function newProductCostLog(Product $product) { $lastProduct = ProductQuery::create()->findByPKOrThrow($product->getIdProduct(), $this->i18n->_("The Product with id {$product->getIdProduct()} does not exist")); $now = \Zend_Date::now(); $log = ProductCostLogFactory::createFromArray(array('id_product' => $product->getIdProduct(), 'id_user' => $this->getUser()->getBean()->getIdUser(), 'date' => $now->get('yyyy-MM-dd HH:mm:ss'), 'price_from' => $lastProduct->getCost(), 'id_currency_from' => $lastProduct->getIdCurrency(), 'price_to' => $product->getCost(), 'id_currency_to' => $product->getIdCurrency())); $this->getCatalog('ProductCostLogCatalog')->create($log); return $log; }
/** * @return \Application\Model\Bean\ProductLog */ private function newLog(ProductCostLog $productCostLog, $eventType) { $now = \Zend_Date::now(); $log = ProductCostLogFactory::createFromArray(array('id_product' => $productCostLog->getIdProduct(), 'id_user' => $this->getUser()->getBean()->getIdUser(), 'date' => $now->get('yyyy-MM-dd HH:mm:ss'), 'price_from' => $productCostLog->getPriceFrom(), 'id_currency_from' => $productCostLog->getIdCurrencyFrom(), 'price_to' => $productCostLog->getPriceTo(), 'id_currency_to' => $productCostLog->getIdCurrencyTo(), 'event_type' => $eventType, 'notes' => $productCostLog->getNotes())); $this->getCatalog('ProductCostLogCatalog')->create($log); return $log; }
/** * * makeBean * @param array $resultset * @return \Application\Model\Bean\ProductCostLog */ protected function makeBean($resultset) { return ProductCostLogFactory::createFromArray($resultset); }