/** * @param ApiLot[] $lots * @throws \Exception */ public function processLots($lots) { /** @var $data AggLot */ $data = $this->_manObj->create(AggLot::class); foreach ($lots as $item) { $data->setOdooId($item->getIdOdoo()); $data->setCode($item->getNumber()); $data->setExpDate($item->getExpirationDate()); $lotExists = $this->_repoAggLot->getByOdooId($data->getOdooId()); if (!$lotExists) { $this->_repoAggLot->create($data); } } }