Note that there are some explanatory texts on larger screens.

plurals
  1. POsymfony doctrine query result and execute function
    primarykey
    data
    text
    <p>I have this doctrine query in symfony. It returns a lot of rows when i run mysql code generated by this dql query in phpBB but when i run it in symfony and access its results with this code:</p> <pre><code>foreach ($this-&gt;courses as $course){ echo "&lt;br&gt;".$course-&gt;firstname;} </code></pre> <p>it returns only one name. Also when i try to get <strong>$course->title</strong>, this error appears <strong>Unknown record property / related component "title" on "Students"</strong></p> <p>Query:</p> <pre><code>$q= Doctrine_Query::create() -&gt;select('s.firstname, s.middlename, s.lastname, p.program, c.title, pc.year') -&gt;from('Students s') -&gt;leftJoin('s.Programs p') -&gt;leftJoin('p.Programcourses pc') -&gt;leftJoin('pc.Courses c') -&gt;where("idstudents = ?",2); $this-&gt;courses=$q-&gt;execute(); </code></pre> <p>schema.yml:</p> <pre><code> Courses: connection: doctrine tableName: courses columns: idcourses: type: integer(4) fixed: false unsigned: false primary: true autoincrement: true title: type: string(45) fixed: false unsigned: false primary: false notnull: false autoincrement: false relations: Programcourses: local: idcourses foreign: idcourses type: many Programcourses: connection: doctrine tableName: programcourses columns: idprogramcourses: type: integer(4) fixed: false unsigned: false primary: true autoincrement: true idprograms: type: integer(4) fixed: false unsigned: false primary: false notnull: false autoincrement: false idcourses: type: integer(4) fixed: false unsigned: false primary: false notnull: false autoincrement: false year: type: integer(4) fixed: false unsigned: false primary: false notnull: false autoincrement: false relations: Courses: local: idcourses foreign: idcourses type: one Programs: local: idprograms foreign: idprograms type: one Programs: connection: doctrine tableName: programs columns: idprograms: type: integer(4) fixed: false unsigned: false primary: true autoincrement: false program: type: string(45) fixed: false unsigned: false primary: false notnull: false autoincrement: false relations: Programcourses: local: idprograms foreign: idprograms type: many Students: local: idprograms foreign: idprograms type: many Roles: connection: doctrine tableName: roles columns: idroles: type: integer(4) fixed: false unsigned: false primary: true autoincrement: false role: type: string(45) fixed: false unsigned: false primary: false notnull: false autoincrement: false Students: connection: doctrine tableName: students columns: idstudents: type: integer(4) fixed: false unsigned: false primary: true autoincrement: true firstname: type: string(45) fixed: false unsigned: false primary: false notnull: false autoincrement: false middlename: type: string(45) fixed: false unsigned: false primary: false notnull: false autoincrement: false lastname: type: string(45) fixed: false unsigned: false primary: false notnull: false autoincrement: false idprograms: type: integer(4) fixed: false unsigned: false primary: false notnull: false autoincrement: false session: type: integer(4) fixed: false unsigned: false primary: false notnull: false autoincrement: false username: type: string(45) fixed: false unsigned: false primary: false notnull: false autoincrement: false password: type: string(45) fixed: false unsigned: false primary: false notnull: false autoincrement: false email: type: string(255) fixed: false unsigned: false primary: false notnull: false autoincrement: false relations: Programs: local: idprograms foreign: idprograms type: one Teachers: connection: doctrine tableName: teachers columns: idteachers: type: integer(4) fixed: false unsigned: false primary: true autoincrement: true firstname: type: string(45) fixed: false unsigned: false primary: false notnull: false autoincrement: false lastname: type: string(45) fixed: false unsigned: false primary: false notnull: false autoincrement: false username: type: string(45) fixed: false unsigned: false primary: false notnull: false autoincrement: false password: type: string(45) fixed: false unsigned: false primary: false notnull: false autoincrement: false email: type: string(255) fixed: false unsigned: false primary: false notnull: false autoincrement: false </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload