[Solar-talk] Proposal: Remove namespace to Solar::loadClass()/factory()
Rodrigo Moraes
rodrigo.moraes at gmail.com
Tue Nov 7 08:55:18 PST 2006
On 11/7/06, Antti Holvikari wrote:
> Sorry if I have completely missed your point but doesn't
> Solar::dependency() do the job?
Hi Antti,
This is a different thing. There are places in Solar where a specific
class is instantiated using factory(). Travis proposes some kind of
mechanism to point (or not) to other classes using a specific
factory() request. Basically, the result of his proposal would be that
Solar::factory('Solar_Sql') would return a class that implements the
Solar_Sql interface, by default Solar_Sql but not necessarily
Solar_Sql.
One quick example: you have changed your Request class to work
differently than Solar_Request. But Solar_Uri uses specifically
Solar::factory('Solar_Request'), so you would have to fork Solar_Uri
too. If I understood well, the idea would be to add some logic to
check if factory() should return the default Solar_Request or another
class which has the same interface.
I like the idea, because I have faced "problems" similar to the
example above - not big problems, but well, I agree that this could be
improved. Luckily Solar is very clean and doesn't have many hardcoded
dependencies, but maybe one day you will have no option than fork or
extend a class just because of one factory() call.
rodrigo
---------------------------------------------------------------------
Solar has now a Community Wiki: solarphp.org
---------------------------------------------------------------------
Join the #solarphp IRC channel on freenode.org
---------------------------------------------------------------------
More information about the solar-talk
mailing list