Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Updates a corporation.
- *
- * @param string $key
- * @param string $secret
- * @param array $updates
- */
- public function updateCorporationAction($key, $secret, Array $updates) {
- $listContainer = $this->listContainerRepository->findByKeyAndSecret($key, $secret)->getFirst();
- if($listContainer !== NULL) {
- $corporation = $listContainer->getCorporation();
- foreach ($updates as $key => $value) {
- $method = 'set' . ucfirst(strtolower($key));
- if(method_exists($corporation, $method)) {
- $corporation->$method($value);
- }
- }
- $this->corporationRepository->update($corporation);
- $this->view->assign('values', array('corporation' => $corporation->getName()));
- $this->view->assign('success', TRUE);
- $this->view->assign('info', 'Corporation successfully updated.');
- } else {
- $this->setErrorMessage('Key and secret mismatch or given list does not exist.');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment