/** * @inheritdoc */ public function create(Request\ICreate $data) { /** @var Response\Create $result */ $result = $this->_manObj->create(Response\Create::class); $def = $this->_manTrans->begin(); try { $warehouse = $data->getWarehouse(); $bind = [EntityWarehouse::ATTR_STOCK_REF => $warehouse->getStockRef(), EntityWarehouse::ATTR_CODE => $warehouse->getCode(), EntityWarehouse::ATTR_CURRENCY => $warehouse->getCurrency(), EntityWarehouse::ATTR_NOTE => $warehouse->getNote()]; $id = $this->_repoEntityWarehouse->create($bind); $result->setId($id); $result->markSucceed(); $this->_manTrans->commit($def); } finally { $this->_manTrans->end($def); } return $result; }