ZF-11862: model find result shoud be return .
Description
http://framework.zend.com/manual/en/…
The example of // application/models/GuestbookMapper.php
class Application_Model_GuestbookMapper
public function find($id, Application_Model_Guestbook $guestbook)
the $guestbook should return , but it not, please fixed the small mistake.
public function find($id, Application_Model_Guestbook $guestbook)
{
$result = $this->getDbTable()->find($id);
if (0 == count($result)) {
return;
}
$row = $result->current();
$guestbook->setId($row->id)
->setEmail($row->email)
->setComment($row->comment)
->setCreated($row->created);
}
Comments
Posted by Adam Lundrigan (adamlundrigan) on 2011-10-31T12:49:39.000+0000
The above code is correct, as an instance of {{Application_Model_Guestbook}} is provided to the {{find}} method. As objects are passed by reference, you can use the result of the {{find}} method in your code like so:
The manual page should be updated to show an example of how to load a specific record.
Posted by netroby (netroby) on 2011-10-31T13:33:30.000+0000
why not it return as usual?
Posted by netroby (netroby) on 2011-10-31T13:41:16.000+0000
Maybe the code will be more readable to other programmer.
Posted by Adam Lundrigan (adamlundrigan) on 2011-12-01T13:12:12.000+0000
The mapper<->model interaction used in the quickstart was chosen by the author, and is a matter of personal taste. It is meant for demonstration purposes, and you can modify/extend/enhance it in any way you see fit within your own implementation.