Hello Chris thanks for your reply.

Since the beginning i have used in this way

// View helper
class My_View_Helper_BugList extends Zend_View_Helper_Abstract
{
    public function bugList(array $bugs)
    {
        foreach ($bugs as $bug) {
            $bug = (array) $bug;
            // ...
        }
    }
}


But after really realize the use of object-oriented  programming and
the datamapper patterns, now any collection of data is not a simple
array of data but really instances of my models. So i moved to your
first example.

class My_View_Helper_BugList extends Zend_View_Helper_Abstract
{
   public function bugList(Bug $model)
   {
       // ...
   }
}

But now im in a situation that i need repeat my code in a dozen of
differente places . So if im not include the model or a service
directly into the helper i really need to have my instances in any
controller action to properly pass the data to view.


So i think will keep in this way as i always have done (instantiating
the stuff in controller) , at least this give me a peace of mind for
not breaking any  rule.

Thank you


-- 
View this message in context: 
http://n4.nabble.com/model-attached-in-a-view-helper-tp1746059p1746836.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to