Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your top node is the a <code>Students</code> object, because you use <code>Students</code> in the <code>from()</code></p> <p>Your error describe this </p> <blockquote> <p>Also when i try to get <code>$course-&gt;title</code>, this error appears <code>Unknown record property / related component "title" on "Students"</code></p> </blockquote> <p>because you have a <code>Students</code> object, not a <code>Courses</code> one (where <code>title</code> belongs)</p> <p>You are confusing yourself using </p> <blockquote> <p>$this->courses=$q->execute();</p> </blockquote> <hr> <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 = ?", $studentid); // beware to SQL injection, use parameters $this-&gt;Student=$q-&gt;fectchOne(); // as you are only retrieve one in your where clause $this-&gt;Student=$q-&gt;execute()-&gt;getFirst(); // same </code></pre> <hr> <pre><code>&lt;tr&gt; &lt;td&gt;&lt;?php echo $i; /* not sure what this is for */ ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $Student-&gt;Programs-&gt;Programcourses-&gt;Courses-&gt;title ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $Student-&gt;Programs-&gt;Programcourses-&gt;year ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $Student-&gt;Programs-&gt;program ?&gt;&lt;/td&gt; &lt;/tr&gt; </code></pre> <hr> <p>If you want <code>Courses</code> to be the top, just go for something like:</p> <pre><code>$q= Doctrine_Query::create() -&gt;select('s.firstname, s.middlename, s.lastname, p.program, c.title, pc.year') -&gt;from('Courses c') -&gt;leftJoin('c.Programcourses pc') -&gt;leftJoin('pc.Programs p') -&gt;leftJoin('p.Students s') -&gt;where("s.idstudents = ?", $studentid); </code></pre>
    singulars
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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