Zend Framework

Zend_View_Helper_PartialLoop turns all objects into array even when the objectKey is set

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major 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

Activity

Hide
Christopher Manning added a comment -

Caused by this issue

Show
Christopher Manning added a comment - Caused by this issue
Hide
Wil Sinclair added a comment -

Please evaluate and fix/categorize as necessary.

Show
Wil Sinclair added a comment - Please evaluate and fix/categorize as necessary.
Hide
Jon Whitcraft added a comment -
Show
Jon Whitcraft added a comment - this was fixed http://framework.zend.com/code/changelog/Standard_Library?cs=10278 and is a dupe of ZF-4141

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: