title: Get table alias from Zend_Db_Table_Select
body: <p>I'm working on an Active Record pattern (similar to RoR/Cake) for my Zend Framework library. My question is this: How do I figure out whether a select object is using an alias for a table or not? </p>
  
  <pre><code>$select-&gt;from(array("c" =&gt; "categories"));
  </code></pre>
  
  <p><strong>vs.</strong></p>
  
  <pre><code>$select-&gt;from("categories");
  </code></pre>
  
  <p>and I pass this to a "fetch" function which adds additional joins and whatnot to get the row relationships automatically...I want to add some custom sql; either "c.id" or "categories.id" based on how the user used the "from" method.</p>
  
  <p>I know I can use </p>
  
  <pre><code>$parts = $select-&gt;getPart(Zend_Db_Select::FROM); 
  </code></pre>
  
  <p>to get the from data as an array, and the table name or alias seems to be in "slot" 0 of said array. Will the table name or alias always be in slot zero? i.e. can I reliably use:</p>
  
  <pre><code>$tableNameOrAlias = $parts[0];
  </code></pre>
  
  <p>Sorry if this is convolute but hope you can help! :)</p>