I was trying to understand the quickstart guide on the ZF site. 

My question is about the model part.
First of all a little check to see if I understand the stuff. As I
understand Zend_Db_Table handles the stuff with database. The mapper maps
this to the model and the model handles everything about getting and setting
data. Is this correct?

Now the question, is it me or in the end the data we passed to the view is a
little bit large. I mean the whole model object is passed to the final view.
Is this the correct way to do it?

And finally if I wanted to find to all posts from a certain user do I need a
new function in the mapper? Something like 
    
public function postsByUser($userId)
    {
        $resultSet =
$this->getDbTable()->fetchAll($this->getDbTable()->select()->where('user_id
= ?', $userId));

        $entries   = array();
        foreach ($resultSet as $row) {
            $entry = new Model_List();
            $entry->setId($row->id)
                  ->setEmail($row->email)
                  ->setComment($row->comment)
                  ->setCreated($row->created)
                  ->setMapper($this);

            $entries[] = $entry;
        }
        return $entries;
    }

or is there better way.


-- 
View this message in context: 
http://www.nabble.com/Zend-Model-and-quickstart-tp23445168p23445168.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to