/** * @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; }