greatdayswithyou
New Member
I have entity like this:\[code\]/** * * @Table(name="table") * @Entity */ class Table { /** * @Column(type="integer") * @Id * @GeneratedValue(strategy="IDENTITY") */ private $id; /** * @ManyToOne(targetEntity="Entities\Users") * @joinColumn(name="userId", referencedColumnName="id") */ private $User; /** * @Column(type="string") */ private $text;}\[/code\]If i do \[code\]$q->getQuery()->getSingleResult()->getUser()->getUserId()\[/code\]doctrine generate query like:\[code\]SELECT * FROM table t INNER JOIN users u ON u.id = t.userId WHERE id = 100\[/code\]but if i don`t need table users, how to get an userId.In pure SQL i can just\[code\]SELECT * FROM table WHERE id = 100\[/code\]and get userId without join users table.