Issue Bug Rejected

#67361Custom Viewhelpers with LazyObjectStorage or ObjectStorage crash

Pascal Geldmacher 06/09/15, 08:15 updated 06/09/15, 17:37

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;
    }
}

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.