Open utterly-calm opened 8 years ago
$this->getHeader('city')->getCell()->addDecorator('callable', array( 'callable' => function($context, $record){ if(is_object($record->school_branches)){ echo "<pre>"; print_r($record->getSchoolBranches()[0]->getCity()); die; return $record->getSchoolBranches()[0]->getCity(); }else{ return ''; } } ));
print_r($record->getSchoolBranches()[0]->getCity()); // it prints correct value
but
return $record->getSchoolBranches()[0]->getCity(); //Fatal error: Call to a member function getCity() on a non-object in ...
but