Project

General

Profile

Actions

Bug #67361

closed

Custom Viewhelpers with LazyObjectStorage or ObjectStorage crash

Added by Pascal Geldmacher over 9 years ago. Updated over 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

Also available in: Atom PDF