On 7/21/05, David Zülke <[EMAIL PROTECTED]> wrote:
> 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'));

I do like this approach better. It sort of conflicts with another
itch, but we can possibly iron out both itches in one shot. The other
itch is not being able to pass parameters into models that have
functional constructors.  Would you be ok with the optional singleton
parameter being 4th in the method signature?

Controller::getModel($module, $model, $args=null, $means=null)

$means for lack of a better word, would be the 'getInstance' call
$args would be passed either in new Model($args) or Model::getInstance($args)

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

Reply via email to