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

Get ViewModel children by capture #5255

Merged
merged 11 commits into from
Jan 3, 2014
Merged

Get ViewModel children by capture #5255

merged 11 commits into from
Jan 3, 2014

Conversation

jaapio
Copy link
Contributor

@jaapio jaapio commented Oct 10, 2013

We wanted to add new content to the page view model using a listener. But in the MvcEvent pass to the listeners the view model is always the complete layout ViewModel and not only the page content model. So we needed a way to get a ViewModel by it's location in the template.

* @param bool $recursive search recursive through children, default true
* @return array
*/
public function getChildrenByCaptureTo($capture, $recursive = true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a BC break

@jaapio
Copy link
Contributor Author

jaapio commented Oct 17, 2013

So I don't add it to the interface?

@Ocramius
Copy link
Member

@jaapio correct

* @param bool $recursive search recursive through children, default true
* @return array
*/
public function getChildrenByCaptureTo($capture, $recursive = true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternate possibility: add a new interface, "RetrievableChildrenInterface" or similar, and have the ViewModel also implement that interface. That way we can combine the two interfaces (or have the ViewModelInterface extend it) in 3.0, and users can test for that interface prior to calling the method.

@jaapio
Copy link
Contributor Author

jaapio commented Oct 24, 2013

Sounds good, but before I start more modifications I would like to know if this will be merged any way. Because if you don't like our solution at all, it is better to close this pr. :-)

@weierophinney
Copy link
Member

@jaapio yes, I'll merge it after you make the changes. :)

weierophinney added a commit that referenced this pull request Jan 3, 2014
weierophinney added a commit that referenced this pull request Jan 3, 2014
@weierophinney weierophinney merged commit cda48a9 into zendframework:develop Jan 3, 2014
@ghost ghost assigned weierophinney Jan 3, 2014
@jaapio jaapio deleted the getChildrenByCapture branch January 8, 2014 08:57
weierophinney added a commit to zendframework/zend-view that referenced this pull request May 15, 2015
…/getChildrenByCapture

Get ViewModel children by capture
weierophinney added a commit to zendframework/zend-view that referenced this pull request May 15, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants