sfRenderingFilter.class.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 11286 2008-09-02 10:27:36Z fabien $
  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. // get response object
  33. $response = $this->context->getResponse();
  34. // hack to rethrow sfForm and|or sfFormField __toString() exceptions (see sfForm and sfFormField)
  35. if (sfForm::hasToStringException())
  36. {
  37. throw sfForm::getToStringException();
  38. }
  39. else if (sfFormField::hasToStringException())
  40. {
  41. throw sfFormField::getToStringException();
  42. }
  43. // send headers + content
  44. $response->send();
  45. }
  46. }