1. sfActions.class.php
  2. /** * sfActions executes all the logic for the current request. * * @package symfony * @subpackage action * @author Fabien Potencier * @author Sean Kerr * @version SVN: $Id: sfActions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $ */
  3. abstract class sfActions extends sfAction
  4. {
  5. /**
  6. * Dispatches to the action defined by the 'action' parameter of the sfRequest object.
  7. *
  8. * This method try to execute the executeXXX() method of the current object where XXX is the
  9. * defined action name.
  10. *
  11. * @param sfRequest $request The current sfRequest object
  12. *
  13. * @return string A string containing the view name associated with this action
  14. *
  15. * @throws sfInitializationException
  16. *
  17. * @see sfAction
  18. */
  19. public function execute($request)
  20. {
  21. // dispatch action
  22. $actionToRun = 'execute'.ucfirst($this->getActionName());
  23. if ($actionToRun === 'execute')
  24. {
  25. // no action given
  26. throw new sfInitializationException(sprintf('sfAction initialization failed for module "%s". There was no action given.', $this->getModuleName()));
  27. }
  28. if (!is_callable(array($this, $actionToRun)))
  29. {
  30. // action not found
  31. throw new sfInitializationException(sprintf('sfAction initialization failed for module "%s", action "%s". You must create a "%s" method.', $this->getModuleName(), $this->getActionName(), $actionToRun));
  32. }
  33. if (sfConfig::get('sf_logging_enabled'))
  34. {
  35. $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Call "%s->%s()"', get_class($this), $actionToRun))));
  36. }
  37. // run action
  38. return $this->$actionToRun($request);
  39. }
  40. }

Debug toolbar