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

Support casting zend-view models to arrays #185

Merged

Conversation

weierophinney
Copy link
Member

Currently, if you use zend-view view models, but decide to switch to an alternate template implementation, you must also change the rest of your code to eliminate the view models (see discussion on zend-view Expressive renderer repository.

This patch introduces the following:

  • Tests for the ArrayParametersTrait::normalizeParams() implementation.
  • Code that uses duck-typing to locate zend-view view models, and, when discovered, return the result of getVariables().

Duck-typing was used so as to eliminate the need for an additional dependency. Hopefully, a future update to zend-view will eliminate the need for this check at all. In the meantime, this allows each of the Zend\View\Model\ModelInterface implementations to be used with any of the template renderer implementations.

- Tests both existing behavior, as well as proposed behavior around
  zend-view view models.
@weierophinney weierophinney force-pushed the feature/view-model-support branch from ecd9e92 to fa04be5 Compare November 17, 2015 21:22
@weierophinney weierophinney added this to the 1.0.0rc3 milestone Nov 17, 2015
@mwillbanks mwillbanks merged commit fa04be5 into zendframework:master Nov 20, 2015
mwillbanks added a commit that referenced this pull request Nov 20, 2015
Support casting zend-view models to arrays
mwillbanks added a commit that referenced this pull request Nov 20, 2015
mwillbanks added a commit that referenced this pull request Nov 20, 2015
@weierophinney weierophinney deleted the feature/view-model-support branch November 24, 2015 16:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants