Php Symfony2.4从实体表以外的表中提取属性
假设我有一个物体Php Symfony2.4从实体表以外的表中提取属性,php,symfony,orm,doctrine,Php,Symfony,Orm,Doctrine,假设我有一个物体 /** * @Table(name="a") * repo class definition annotation here **/ class A { /** * @Column(name="id") * ... etc **/ private $id; /** * this is pulled from another table. It is not an entity, just a decimal v
/**
* @Table(name="a")
* repo class definition annotation here
**/
class A {
/**
* @Column(name="id")
* ... etc
**/
private $id;
/**
* this is pulled from another table. It is not an entity, just a decimal value
*/
private $otherThingFromAnotherTable;
}
如何使用ORM注释从另一个表从另一个表中提取$otherthing?它不是一个实体,它只是一个十进制值
到目前为止,我有以下注释:
* @ORM\OneToOne(targetEntity="??")
* @ORM\JoinTable(name="other_table",
* joinColumns={
* @ORM\JoinColumn(name="offer_id", referencedColumnName="id")
* }
* )
目前,我只是在repo类中使用原始查询,以便通过实体管理器使用它。不幸的是,这只返回一个数组,而不是对象。我希望能够使用$this->em->repo->find$id,让它自动拉取所有内容,而不是自定义方法