dudapiotr / ZfTable

*Not supported*ZfTable 3.1. Awesome ZF2 table / grid (and much much more) generator with huge possibilities of decorating and conditioning. Integrated with DataTables, Doctrine 2, Bootstrap 2.0 and 3.0.
http://dudapiotrek.laohost.net/
MIT License
75 stars 59 forks source link

Doctrine 2 joining is fine but problem in displaying its value inside table. #88

Open utterly-calm opened 8 years ago

utterly-calm commented 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 ...