Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Duplicate
-
Affects Version/s: 1.5.2
-
Fix Version/s: None
-
Component/s: Zend_View
-
Labels:None
Description
Zend_View_Helper_Partial allows an $_objectKey to be set; this is helpful since it allows you to call functions on the object in the partialLoop
The below example worked in 1.5.1 but now fails in 1.5.2 since $this->model is turned into an array.
myview.phtml
<?php
$partial = $this->partialLoop();
$partial->setObjectKey('model');
print $partial->partialLoop('mypartial.phtml', $this->dbRowset);
?>
mypartial.phtml
<?php
$this->model->function();
?>
I propose editing L:70 of Zend_View_Helper_PartialLoop
From:
if (is_object($model) && method_exists($model, 'toArray')) {
To:
if (is_object($model) && method_exists($model, 'toArray') && $this->_objectKey === null) {
Issue Links
| This issue duplicates: | ||||
| ZF-4141 | Zend_View_Helper_PartialLoop forces objects to array conversion when object exposes toArray() |
|
|
|
| This issue is related to: | ||||
| ZF-2431 | Zend_View_Helper_Partial does not support an object to be passed in. |
|
|
|
| ZF-3133 | Zend_View partialLoop should accept objects that implement the toArray() method |
|
|
|
Caused by this issue