Project

General

Profile

Actions

Bug #67361

closed

Custom Viewhelpers with LazyObjectStorage or ObjectStorage crash

Added by Pascal Geldmacher almost 9 years ago. Updated almost 9 years ago.

Status:
Rejected
Priority:
Must have
Assignee:
-
Category:
Fluid
Target version:
-
Start date:
2015-06-09
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
5.5
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

If i try to assign a LazyObjectStorage in a custom viewhelper i get a Fatal Error.

Catchable fatal error: Object of class TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage could not be converted to string

The fluid viewhelper works fine with it, but all custom viewhelpers like my owns or the from VHS produce a fatal error.

Here is an example of one of my viewhelpers:

class ObjectMaxViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper {

    /**
     * @param array $data
     * @param string $refSearchField
     * @return integer
     */
    public function render($data = NULL, $refSearchField) {
        $max = 0;
        if($data instanceof \Iterator){
            foreach($data as $obj) {
                $val = floatval($obj->_getProperty($refSearchField));
                if($val > $max) {
                    $max = $val;
                }
            }
        }else {
            $val = floatval($data->_getProperty($refSearchField));
            $max = $val;
        }

        return $max;
    }
}
Actions #1

Updated by Anja Leichsenring almost 9 years ago

  • Status changed from New to Rejected
if ($data instanceof LazyObjectStorage) {
  $data->loadRealInstance();
}

no bug, sorry

Actions

Also available in: Atom PDF