/** * Sauvegarde ou met a jour l'item passé. * @param \Commun\Model\Items $oItems * @return \Core\Model\Items */ public function saveOrUpdateItem($oItems) { try { $oTabItem = $this->selectBy(array('idBnet' => $oItems->getIdBnet())); } catch (\Exception $exc) { throw new DatabaseException(3000, 4, $this->_getServiceLocator(), $oItems->getArrayCopy(), $exc); } //si il existe pas on le cree if (!$oTabItem) { try { $oTabItem = new \Commun\Model\Items(); $oTabItem->setAjouterPar("Import Raid-TracKer"); $oTabItem->setNom(strtolower($oItems->getNom())); $oTabItem->setIcon($oItems->getIcon()); $oTabItem->setIdBnet($oItems->getIdBnet()); $this->insert($oTabItem); $oTabItem->setIdItem($this->lastInsertValue); } catch (\Exception $exc) { throw new DatabaseException(3000, 2, $this->_getServiceLocator(), $oItems->getArrayCopy(), $exc); } } return $oTabItem; }