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 will be with correct count of fields but values of parent class
will be null. How can I correctly get all the fields?
And when I try to use:
->select('t.someField') // Error
->select('t.otherField') // Good
No comments:
Post a Comment