public function unassignAggregatorAction() { if (!$this->getRequest()->isPost()) { throw new AppEx\UnexpectedException("Resquest must be POST"); } $data = $this->_helper->requestData(); $cgId = $data['cgId']; if (!isset($cgId) && !strlen($cgId)) { throw new AppEx\InvalidArgumentException('You must indicate a commercial group id'); } $commercialGroup = $this->_cgSrv->load($cgId); //GLOBALPORTAL-34278 //TODO: very hacky approach don't like it $commercialGroupData = $commercialGroup->exportData(); $commercialGroupData = $this->_cgSrv->cleanDataForUpdate($commercialGroupData); $commercialGroupData = $this->_cgSrv->clearDataForUpdate($commercialGroupData); $commercialGroup->importData($commercialGroupData); if (empty($commercialGroup)) { throw new NotFoundException("Commercial Group {$cgId} not found", 404); } // Check permissions $this->_helper->allowed('unassign_aggregator', $commercialGroup); $result = $this->_cgSrv->unassignAggregator($commercialGroup); // Response with the organization id $this->view->data = $result; }