sfRenderingFilter.class.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /*
  3. * This file is part of the symfony package.
  4. * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
  5. *
  6. * For the full copyright and license information, please view the LICENSE
  7. * file that was distributed with this source code.
  8. */
  9. /**
  10. * sfRenderingFilter is the last filter registered for each filter chain. This
  11. * filter does the rendering.
  12. *
  13. * @package symfony
  14. * @subpackage filter
  15. * @author Fabien Potencier <fabien.potencier@symfony-project.com>
  16. * @version SVN: $Id: sfRenderingFilter.class.php 10439 2008-07-23 12:36:55Z nicolas $
  17. */
  18. class sfRenderingFilter extends sfFilter
  19. {
  20. /**
  21. * Executes this filter.
  22. *
  23. * @param sfFilterChain $filterChain The filter chain.
  24. *
  25. * @throws <b>sfInitializeException</b> If an error occurs during view initialization
  26. * @throws <b>sfViewException</b> If an error occurs while executing the view
  27. */
  28. public function execute($filterChain)
  29. {
  30. // execute next filter
  31. $filterChain->execute();
  32. if (sfConfig::get('sf_logging_enabled'))
  33. {
  34. $this->context->getEventDispatcher()->notify(new sfEvent($this, 'application.log', array('Render to the client')));
  35. }
  36. // get response object
  37. $response = $this->context->getResponse();
  38. // hack to rethrow sfForm and|or sfFormField __toString() exceptions (see sfForm and sfFormField)
  39. if (sfForm::hasToStringException())
  40. {
  41. throw sfForm::getToStringException();
  42. }
  43. else if (sfFormField::hasToStringException())
  44. {
  45. throw sfFormField::getToStringException();
  46. }
  47. // send headers + content
  48. $response->send();
  49. }
  50. }