Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Feature/render listener #2959

Merged
merged 15 commits into from
Nov 13, 2012

Conversation

weierophinney
Copy link
Member

This request builds on #2812, which is intended as a solution for #2528. The idea is to allow catching renderer exceptions, and triggering an additional event when one is detected.

The main differences between this PR and #2812 are:

  • Moves the exception handling into the DefaultRenderingStrategy. This better mirrors how the route and dispatch exceptions are handled, and keeps the Application class clean.
  • Moved the clearChildren() definition out of ModelInterface and into ClearableModelInterface in order to remove a BC break. ViewModel implements this by default. (I also added methods for clearVariables() and clearOptiosn() to the new interface.)
  • Fixed a testing issue created by the fact that exceptions in rendering are now actually handled by the PhpRenderer.

radnan and others added 15 commits October 19, 2012 17:59
Catch exceptions thrown when EVENT_RENDER is triggered, clean up all output, trigger EVENT_DISPATCH_ERROR, and finally re-trigger EVENT_RENDER
… DefaultRenderingStrategy

- For symmetry with DispatchListener and RouteListener, moved the
  exception handling out of Application and into
  Zend\Mvc\View\Http\DefaultRenderingStrategy.
- Reviewed Zend\Mvc\View\Console\DefaultRenderingStrategy to see if
  exception handling was necessary; it wasn't, but cleaned up a few CS
  issues in the process.
- Test now had an expectation that was no longer necessary: that the
  output would continue to be captured and present. Since the
  PhpRenderer now catches exceptions and re-throws, the output buffering
  is handled slightly differently in exceptional circumstances.
…arate interface

- Cannot add methods to existing interfaces; breaks BC
- Created ClearableModelInterface with clearChildren(), and also added
  clearVariables() and clearOptions().
- ViewModel implements ModelInterface and ClearableModelInterface.
- InjectViewModelListener now tests for ClearableModelInterface before
  attempting to clearChildren()
@akrabat
Copy link
Contributor

akrabat commented Nov 13, 2012

Reviewed code - looks sane and unit tests pass here too.

@akrabat akrabat merged commit 43465cc into zendframework:develop Nov 13, 2012
@blockjon
Copy link

I've created a custom form and am trying to render it into a view. However, the form has a bug inside it. DefaultRenderingStrategy::render() is catching it on line 131 and my app subsequently whitescreens and I cannot understand why. Is it related to this merge?

@radnan
Copy link
Contributor

radnan commented Jan 9, 2013

@blockjon yes it is related to this. i've submitted a pr for the fix in #3385.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants