I have a table User, and a table Company.
The table Companyhas a field user_id, but the table User don't have relationships with company.
If Users had a field company_id, I would have done this request :
$queryBuilder
->select('u')
->join('u.company', 'c')
->where('c.name LIKE :name')
;
But as it doesn't, I don't know how I can do it in Doctrine. I already done this request the other way around, I can join the table User in my Company repository.
Your query must look similar to this:
select *
from user u
join company c
on u.userId=c.userId
The relationship is 1 to n ("1" company can have "n" - many- users, so the primary key from user (userId) is added to company table), so the relationship does exist.