I am new to symfony2 and have trouble to do a left join between 2 entities. I\'m getting following error message, and don\'t know how to solve this problem:
I think the querybuilder looks alright. Your problem is likely in the data structure.
The way you normally approach this is by setting up a property per relation. For your Users
class it'd make sense to have an information
or userInformation
one for example.
Perhaps something like this helps?
class User
{
/**
* @ORM\Id
*/
protected $id;
/**
* @ORM\OneToOne(targetEntity="UserInformation")
*/
protected $information;
}
class UserInformation
{
/**
* @ORM\Id
*/
protected $id;
/**
* @ORM\OneToOne(targetEntity="User", inversedBy="information")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
*/
protected $user;
}