symfony - Query builder and entity inheritance -
i have entities:
abstract class abstractentity { private $somefield; } /** * ... * @orm\entity(repositoryclass="concreteentityrepository") */ class concreteentity extends abstractentity { private $otherfield; } class concreteentityrepository extends entityrepository { public function getsomething() { $qb = $this->getentitymanager()->createquerybuilder() ->select('t') ->from('mybundle:concreteentity', 't'); $result = $query->getresult(); } }
result correct count of fields values of parent class null. how can correctly fields?
and when try use:
->select('t.somefield') // error ->select('t.otherfield') //
my guess can't use private properties in abstract class. try using protected ones.
the documentation same: http://docs.doctrine-project.org/en/latest/reference/inheritance-mapping.html.
Comments
Post a Comment