title: Select a Row from a RowSet in ZF2
body: <p>My table looks something like this</p>
  
  <pre><code>    id      uniqueId    userId  album
      1       1           1       Example
      2       2           1       Example
      3       1           2       Example
      4       3           1       Example
      5       2           2       Example
  </code></pre>
  
  <p>I would like to find the Album Title where <code>userId =&gt; 1</code> and <code>uniqueId =&gt; 3</code> (Where id => 4, but I won't have access to that, only the other two).<br> <br>
  To do this I am attempting to <code>getAlbumsByUserId($userId)</code> which will return a RowSet object with User 1's Albums. Then I am trying to get the album from the returned rowset with <code>uniqueId =&gt; 3</code>
  <br>
  <br>
  Something like the below won't work<br>
  <code>$albumObject   = $albumTable-&gt;getAlbumsByUserId(1);</code><br>
  <code>$row = $albumObject-&gt;select(array('uniqueAlbumID' =&gt; 3))-&gt;current();</code><br></p>
  
  <p>This is the function which gets Albums by UserId as a RowSet</p>
  
  <pre><code>public function getAlbumsByUserId($userId)
      {
          $userId     = (int) $userId;
          $rowset = $this-&gt;tableGateway-&gt;select(array('user_id' =&gt; $userId));
  
          return $rowset;
      }
  </code></pre>
  
  <p>I could do a foreach on the RowSet object, to find the uniqueId with an if statement, but I have to think there is a better way.</p>
  
  <p>Edit:
  <br>I still haven't found a way to do a select from resultSet, but you can do 2 where conditions in the select array.</p>