我有实体:
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();
}
}
结果将具有正确的字段计数,但父类的值将为空。如何正确获取所有字段?
当我尝试使用时:
->select('t.someField') // Error
->select('t.otherField') // Good