protected function _updateEricsson(Model\LifeCycleModel $lifeCycle) { $methodName = self::METHOD_NAME_UPDATE; try { $proto = $this->_createProto($methodName); $mappedData = $this->_mapModelToEricssonModel($lifeCycle->exportData()); $proto->parse($mappedData, new \DrSlump\Protobuf\Codec\PhpArray()); $proto->setId($mappedData['id']); $response = $this->_sendRequest($methodName, array('protoMessage' => $proto)); } catch (Exception $e) { \App::log()->CRIT($e); } $this->_checkPostResponse($response); //The request has gone ok, but there is a reason code, so we will return a 304 if ($response->getResult()->getCode() == 0 && $response->getResult()->getReasonCode()) { $data = array('reason' => $response->getResult()->getReason(), 'code' => $response->getResult()->getReasonCode() ?: $response->getResult()->getCode()); throw new EricssonException($response->getResult()->getReason(), $data, null, 304); } $lifeCycle->setId($mappedData['id']); return $lifeCycle->getId(); }
/** * Get one lifecycle, given its ID. * * @param mixed $id * @return mixed */ protected function _findOneById($id) { $proto = $this->_createProto(self::METHOD_NAME_GETDATA); $proto->setId($id); $response = $this->_sendRequest(self::METHOD_NAME_GETDATA, array('protoMessage' => $proto), $this->getEricssonService()); if ($this->_checkGetResponse($response)) { $data = $response->serialize(new \DrSlump\Protobuf\Codec\PhpArray()); if ($data) { unset($data['result']); } $model = new \Application\Model\LifeCycleModel($this->_mapEricssonModelToModel($data)); $model->setId($id); return $model; } return NULL; }