Last active
December 15, 2015 01:49
-
-
Save manticorp/5183012 to your computer and use it in GitHub Desktop.
Passing a Doctrine entity object to a partial or a partial loop in Zend framework
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//You can pass objects to partials, just pass them in an array: | |
$this->partial('mypartial.phtml', array('topic' => $topic')) | |
//The partial helper will take the keys of that array and create view vars out of them, so you can access it like this from within the partial: | |
<td><?= $this->topic->getDescription() ?></td> | |
//If you want to use objects with a partial loop, you can call setObjectKey() on the partialLoop helper and pass in an array of objects: | |
$this->partialLoop()->setObjectKey('topic')->partialLoop('mypartial.phtml', $topics) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment