Cheers folks,

I still think there should be the possibility to have Models that implement
the Singleton pattern. I came up with another idea on how to implement it
today:

Controller:get(Global)Model() could optionally accept an array as the second
(first) argument. This array would contain two items: the model name, as
usual, and, as the second parameter, the method name the Controller should
use to retrieve an instance. So when I do

$this->getContext()->getController()->getModel('Default',
array('Navigation', 'getInstance')); 

The Controller would do a

return NavigationModel::getInstance();

This way, it's clean, it's still transparent, it doesn't add any stuff like
SingletonModel to the framework, you don't need to extend the Model class
any further or whatever. Just this array. Of course, this means that you
have to implement the Singleton thing yourself, but that's not a big deal
IMO.

What do you guys think?

- David


_______________________________________________
agavi-dev mailing list
[email protected]
http://labworkz.com/cgi-bin/mailman/listinfo/agavi-dev

Reply via email to