Join request in symphony doctrine

I have two userdetails tables and a blog question. Scheme

UserDetails: connection: doctrine tableName: user_details columns: id: type: integer(8) fixed: false name: type: string(255) fixed: false BlogQuestion: connection: doctrine tableName: blog_question columns: question_id: type: integer(8) fixed: false unsigned: false primary: true autoincrement: true blog_id: type: integer(8) fixed: false user_id: type: integer(8) fixed: false question_title: type: string(255) 

I use one connection request to extract all questions and user data from these two tables. My connection request is

 $q = Doctrine_Query::create() ->select('*') ->from('BlogQuestion u') ->leftJoin('u.UserDetails p'); $q->execute(); 

But it shows this error Unknown sibling alias UserDetails

No one will help me

Thank you in advance

+1
source share
1 answer

why haven’t you established a relationship in your doctrine?

 UserDetails: connection: doctrine tableName: user_details columns: id: type: integer(8) fixed: false unsigned: false primary: true autoincrement: true BlogQuestion: connection: doctrine tableName: blog_question columns: question_id: type: integer(8) fixed: false unsigned: false primary: true autoincrement: true blog_id: type: integer(8) fixed: false user_id: type: integer(8) fixed: false question_title: type: string(255) relations: UserDetails: local: user_id 

your yml says nothing about the doctrine, with what it should be associated when you leave the connection. I just created it myself and it works

+2
source

Source: https://habr.com/ru/post/1379006/


All Articles