public function insert($productUom) { if ($productUom instanceof AbstractModel) { $data = array('uom_code' => $productUom->getUomCode(), 'product_id' => $productUom->getProductId(), 'quantity' => $productUom->getQuantity()); } elseif (is_array($productUom)) { $data = $productUom; } parent::insert($productUom); $productUom = $this->find($data); return $productUom; }
public function insert($option) { $parent = $this->getExistingParent($option); $option = parent::insert($option); if ($parent instanceof \SpeckCatalog\Model\Product) { $this->getProductService()->addOption($parent, $option); $option->setParent($parent); } if ($parent instanceof \SpeckCatalog\Model\Choice) { $this->getChoiceService()->addOption($parent, $option); $option->setParent($parent); } return $option; }
public function insert($productUom) { if ($productUom instanceof AbstractModel) { $data = array('uom_code' => $productUom->getUomCode(), 'product_id' => $productUom->getProductId(), 'quantity' => $productUom->getQuantity()); } elseif (is_array($productUom)) { $data = $productUom; } $vars = array('data' => $data); $this->getEventManager()->trigger('insert.pre', $this, $vars); $vars['result'] = parent::insert($productUom); $this->getEventManager()->trigger('insert.post', $this, $vars); $productUom = $this->find($data); return $productUom; }