public function changeManLocationAction() { $data = $this->_helper->requestData(); if (isset($data['id']) && strlen($data['id'])) { // Sync request $resp = 'data'; $simOrList = $this->_simSrv->load($data['id']); if (!$simOrList) { throw new InvalidArgumentException('Invalid sim Id.'); } $this->_helper->allowed('update', $simOrList); $this->_helper->allowed('async_sim_change_man_location', $simOrList); } else { // Async request $resp = 'watcher'; $data = $this->_checkAndGetListData('async_sim_change_man_location', true, array('POST', 'DELETE')); $simOrList = $data['list']; } $method = $this->getRequest()->getMethod(); if ($method == 'POST') { if (!$data['location']) { throw new InvalidArgumentException('Bad Request. Malformed Json. parameter {location} is required'); } $location = new \Application\Model\Sim\LocationModel($data['location']); $this->view->{$resp} = $this->_simSrv->changeManLocation($simOrList, $location); } else { if ($method == 'DELETE') { $this->view->{$resp} = $this->_simSrv->removeManLocation($simOrList); } else { throw new AppEx\UnexpectedException("Resquest must be POST or DELETE"); } } if ($resp == 'watcher') { $this->_helper->filterNotAllowedFields('read_field', $this->view->{$resp}); } }