Open ixigen opened 9 years ago
Similar issue in ZfTable\Decorator\Row\VarAttr throwing Cannot use object of type Entity as array in vendor/dudapiotr/zftable/src/ZfTable/Decorator/Row/VarAttr.php on line 42
My Temporary solution:
/** * Rendering decorator * * @param string $context * @return string */ public function render($context) { $values = array(); foreach ($this->vars as $var) { $actualRow = $this->getRow()->getActualRow(); if ( is_object($actualRow) ) { $values[] = $actualRow->$var; }else { $values[] = $actualRow[$var]; } } $value = vsprintf($this->value, $values); $this->getRow()->addVarAttr($this->name, $value); return $context; }
He solved this problem https://github.com/dudapiotr/ZfTable/blob/master/src/ZfTable/Decorator/Cell/Template.php#L58.
The issue still exists in ZfTable\Decorator\Row\VarAttr.php
Fatal error: Cannot use object of type Application\Entity\User as array in /www/vendor/dudapiotr/zftable/src/ZfTable/Decorator/Cell/Template.php on line 58
There two options that I can think of: 1) Array Hydration for Doctrine entities 2) modify the code to access the Doctrine entities as entities not as arrays
Temporary solution: