Guest User

Untitled

a guest
Feb 1st, 2012
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. /**
  2. * Updates a corporation.
  3. *
  4. * @param string $key
  5. * @param string $secret
  6. * @param array $updates
  7. */
  8. public function updateCorporationAction($key, $secret, Array $updates) {
  9. $listContainer = $this->listContainerRepository->findByKeyAndSecret($key, $secret)->getFirst();
  10.  
  11. if($listContainer !== NULL) {
  12. $corporation = $listContainer->getCorporation();
  13.  
  14. foreach ($updates as $key => $value) {
  15.  
  16. $method = 'set' . ucfirst(strtolower($key));
  17.  
  18. if(method_exists($corporation, $method)) {
  19. $corporation->$method($value);
  20. }
  21. }
  22.  
  23. $this->corporationRepository->update($corporation);
  24.  
  25. $this->view->assign('values', array('corporation' => $corporation->getName()));
  26. $this->view->assign('success', TRUE);
  27. $this->view->assign('info', 'Corporation successfully updated.');
  28.  
  29. } else {
  30. $this->setErrorMessage('Key and secret mismatch or given list does not exist.');
  31. }
  32.  
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment