title: Zend Framework relationships - defining column names in findManyToManyRowset()?
body: <p>I'm working on an application developed using Zend Framework. I have defined relationships in models, and can use them happily, e.g:  </p>
  
  <pre><code>$rowset = $row-&gt;findManyToManyRowset('People', 'Jobs');
  </code></pre>
  
  <p>However, i've hit a problem where the rowset is returned has column names that are the same in 'People' and 'Jobs', and therefore, merges the array keys, losing some of the data from the final rowset.  </p>
  
  <p>I understand I can pass a <code>Zend_Db_Select</code> object to <code>findManyToManyRowset()</code> as one of the parameters, but can't find any documentation explaining how to use it in this case, e.g.:  </p>
  
  <pre><code>$select = $this-&gt;select()-&gt;from(array(
                                       'p' =&gt; 'people', 
                                       'j' =&gt; 'jobs'
                                       ),
                                  array( 
                                       'person_id' =&gt; 'p.id',
                                       'job_id' =&gt; 'j.id',
                                       'person_code' =&gt; 'p.code',
                                       'job_code' =&gt; 'j.code'
                                       )
                                  );  
  </code></pre>
  
  <p>If i try to use the above code, I get a message such as:  </p>
  
  <pre><code>Error: No reference rule "" from table People to table Jobs
  </code></pre>
  
  <p>Can anyone enlighten me on how this should be done? I know I could change my column names in the database, but i'd prefer a code change as opposed to re-designing my DB structure and updating all the related code.  </p>
  
  <p>Note: without some form of column aliasing as above, the rowset returned looks like this (ie., it merges the columns with the same names):  </p>
  
  <pre><code>[_data:protected] =&gt; Array
      (
          [id] =&gt; 1
          [code] =&gt; SX342
      )
  </code></pre>
  
  <p>Cheers,<br>
    Matt</p>