public function save(DetailsOutputInventory $detailsOutputInventory) { $data = array('output_inventory' => $detailsOutputInventory->getOutputInventory(), 'product' => $detailsOutputInventory->getProduct(), 'cost' => $detailsOutputInventory->getCost(), 'iva' => $detailsOutputInventory->getIva(), 'serial' => $detailsOutputInventory->getSerial(), 'register_date' => date("Y-m-d H:i:s", time()), 'update_date' => date("Y-m-d H:i:s", time())); $id = (int) $detailsOutputInventory->getId(); if ($id == 0) { $this->tableGateway->insert($data); $id = $this->tableGateway->getLastInsertValue(); if ($id) { return $id; } else { return false; } } else { if ($this->get($id)) { $this->tableGateway->update($data, array('id' => $id)); return $id; } else { return false; } } }