To attempt to make a long story short, I've created a wiki page at
http://trac.agavi.org/trac.cgi/wiki/ConfigurableContexts to try and
describe something that I was just wanting to brainstorm about, but
while writing pseudo code in the wiki I said screw it and went ahead
and did a rough implementation, which you can play with by checking
out the globalization branch.

In a nutshell, I was frustrated by the hard bound coupling in some
parts of the framework, such as where/how the factory objects are
handled. DatabaseManager, for example is untouchable without doing
some pretty hacky things like I'd done with the mockContext stuff to
facilitate testing certain pieces of the framework in a controlled
manner. So, what I was proposing is to do away with factories.ini and
replace it with a contexts.ini which defines what classes are to be
used within different contexts. define a context for Web, one for
Console, one for Testing, one for Mom.. whatever.

How will it impact legacy code?
1. You'll need to make a contexts.ini, fairly similar to the factories.ini
2. rather than creating a controller and dispatching it, eg:
Controller::newInstance('MyController')->dispatch();
you'll need to get it through the context, eg:
Context::getInstance()->getController()->dispatch();
which will bring up whatever is defined as default or
Context::getInstance('Console')->getController()->dispatch();
etc...
 
I also deprecated Controller::getInstance in the process, Controller
isnt a singleton and if you need a controller instance you should get
it from the context.

Oh, I think there might've been something strange with handling dot
(.) ini parameters but I didnt dig into it.

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

Reply via email to