Symfony 2: INNER JOIN on non related table with doctrine query builder
I'm trying to build a query with the doctrine query builder which joins a non related table like this: $query = $this->createQueryBuilder('gpr') ->select('gpr, p') ->innerJoin('TPost', 'p') ->where('gpr.contentId = p.contentId') But this doesn't work. I still get an error: Error: Identification Variable TPost used in join path expression but was not defined before. I searched for this error message and everybody answered to use the table alias + attribute like p.someAttribute. But the table I want to join isn't related in the table I start my select from. As a normal mysql query i would write