-- Marko Korhonen <marko.korho...@datafisher.com> wrote (on Monday, 06 April 2009, 01:43 AM -0700): > I have made my model system as: > Model, Model_DbTable, Model_DbTable_Row etc... > > I have always declared by models in controller, but MVC seems > to "allow" View to command models also? > I also try to live by the "Fat models, thin controllers" rule... > > So I made following: > > <select name="faculty" id="faculty"> > > <option value="">-- Filter by Faculty --</option> > <?php $model = new Material_Model_Faculty(); foreach ($model->getAll() > as > $faculty): ?> > <option value="<?= $this->url(array("faculty" => $faculty->id), > "materials") ?>"><?= $faculty->name ?></option> > <?php endforeach; ?> > > </select> > > This is kinda "religious" question, I know... =) > But this approach gives me very flexible developing...
Yes, views are allowed to access models for read-only purposes. It's usually better, however, to pass the model to the view from the controller or to wrap access to the model within a view helper rather than to instantiate it directly. -- Matthew Weier O'Phinney Software Architect | matt...@zend.com Zend Framework | http://framework.zend.com/