ZF-5323: Return the columns/fields for a row
Description
I think it would be useful to be able to get the columns/fields from a Row or Rowset from a Row you could do
function getColumns()
{
return array_keys( $this->_data )
}
From a RowSet you will need to get the first Row (if there is one) then run the same getColumns call. I perdonally would use this when building a sort form so providing the ability to sort or not sort via one or more columns in the database.
Comments
Posted by Adam Lundrigan (adamlundrigan) on 2012-05-12T02:10:10.000+0000
Attached fix and unit tests
Posted by Adam Lundrigan (adamlundrigan) on 2012-05-29T02:12:53.000+0000
On second review, this functionality already exists (albeit in a slightly roundabout way). Both Row and Rowset supply a {{getTable()}} method, so this is possible:
I don't see any real added value to providing a {{getColumns}} wrapper around this at this late stage in ZFv1's lifecycle. If anyone disagrees, please feel free to reopen the issue.