iosonogio wrote:
When I need to find an article, I do:
Article::findById(id)
what would you make it return?
It returns an array with the keys named as the article'fields, and it
returns an array because the Zend_Db select query does return an array...
Would you make it return an object? That would mean I have to transform the
array into an Article class object.
If you do:
$article = new Article();
$rowset = $article->find($id);
You'll get a rowset object that contains a single article row object,
rather than an array. To retrieve just the single row object do this:
$article = new Article();
$row = $article->find($id)->current();
That row object will then have all the behaviour (save, delete etc.)
that you'd expect. See:
http://framework.zend.com/manual/en/zend.db.table.html#zend.db.table.find
http://framework.zend.com/manual/en/zend.db.table.row.html
For more info.
--
Jack