/** * * @param Product $product * @param BaseEntityAbstract $entity * @param string $comments * @return Ambigous <BaseEntityAbstract, GenericDAO> */ public static function create(Product $product, $type = '', BaseEntityAbstract $entity = null, $comments = '') { $log = new ProductQtyLog(); $log->setProduct($product)->setType($type)->setStockOnHand($product->getStockOnHand())->setTotalOnHandValue($product->getTotalOnHandValue())->setStockOnOrder($product->getStockOnOrder())->setStockOnPO($product->getstockOnPO())->setStockInParts($product->getStockInParts())->setTotalInPartsValue($product->getTotalInPartsValue())->setStockInRMA($product->getStockInRMA())->setTotalRMAValue($product->getTotalRMAValue())->setComments($comments); if ($entity instanceof BaseEntityAbstract) { $log->setEntityName(get_class($entity))->setEntityId($entity->getId()); } return $log->save(); }