title: How to display data from 2 related tables in Zend Framework
body: <p>Hello I need help with displaying data from 2 table. </p>
  
  <p>So i Have 2 models:</p>
  
  <pre><code>//Klasy.php
  
  class Model_Klasy extends Zend_Db_Table_Abstract
  {
      protected $_name = 'klasy';
      protected $_primary = 'id';
      protected $_referenceMap = array(
      'Nauczyciele' =&gt; array(
          'columns'       =&gt;  array('Wychowawca'),
          'refTableClass' =&gt;  'Model_Nauczyciele',
          'refColumns'    =&gt;  array('id')
      )
      );
  
      public function listaKlas()
      {
      $dane = $this-&gt;select();
      return $this-&gt;fetchAll();
      }
  }
  </code></pre>
  
  <p>and </p>
  
  <pre><code>//Nauczyciele.php
      class Model_Nauczyciele extends Zend_Db_Table_Abstract
      {
          protected $_name = 'nauczyciele';
          protected $_dependentTables = 'Model_Klasy';
      }
  </code></pre>
  
  <p>In Controller have that code:</p>
  
  <pre><code>public function listaAction()
      {
          $modelLista = new Model_Klasy();
      $this-&gt;view-&gt;listaKlas = $modelLista-&gt;listaKlas();
      }
  </code></pre>
  
  <p>and in View this:</p>
  
  <pre><code>&lt;b&gt;Lista Klas:&lt;/b&gt;
  &lt;table&gt;
      &lt;tr&gt;
      &lt;th&gt;Klasa&lt;/th&gt;
      &lt;th&gt;Rok rozpoczęcia nauki&lt;/th&gt;
      &lt;th&gt;Wychowawca&lt;/th&gt;
      &lt;/tr&gt;
      &lt;tr&gt;&lt;?php echo $this-&gt;partialLoop('partials/ListaKlas.phtml', $this-&gt;listaKlas); ?&gt;&lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>and partial file ListaKlas.phtml:</p>
  
  <pre><code>&lt;tr&gt;
      &lt;td&gt;&lt;?php echo $this-&gt;nazwa; ?&gt;&lt;/td&gt;
      &lt;td&gt;&lt;?php echo $this-&gt;rok_rozpoczecia; ?&gt;&lt;/td&gt;
      &lt;td&gt;
      &lt;?php
      echo $this-&gt;Wychowawca;
      ?&gt;
      &lt;/td&gt;
      &lt;td style="width: 5%"&gt;
      &lt;a href="&lt;?php echo $this-&gt;baseUrl() . '/klasy/edytuj/id/';
              echo $this-&gt;id ;?&gt;"&gt;Edytuj
      &lt;/a&gt;
      &lt;/td&gt;
      &lt;td style="width: 5%"&gt;
      &lt;a href="&lt;?php echo $this-&gt;baseUrl() . '/klasy/usun/id/';
              echo $this-&gt;id ;?&gt;"&gt;Usuń
      &lt;/a&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>from Table Nauczyciele i want display 2 columns but dont know how. I know about method <strong>findParentRow</strong> but dont know where use it and how render data from second table. In my case i see only ID from table Klasy.</p>