[Solar-talk] Proposal: Remove namespace to Solar::loadClass()/factory()
Rodrigo Moraes
rodrigo.moraes at gmail.com
Tue Nov 7 09:24:08 PST 2006
On 11/7/06, Travis Swicegood wrote:
> By specifying "true" as the second parameter, you could override the
> namespace code. This would be necessary for sub-classes that need to
> insure the specific super-class they expect is loaded.
Travis,
I would appreciate a lot if we could replace specific class calls
inside of Solar by other classes. But I'm not sure about using
namespaces and make changes everywhere, so let me propose a dumb
approach which I think is simplest and requires less changes, but
perhaps it is really dumb and would not work. :-)
1. Set an array in Solar config mapping Solar classes to the class you
want to use (by default, empty):
$config['Solar']['classes'] = array(
'Solar_Sql' => 'Domain51_Sql',
);
2. Replace $class in Solar::loadClass(), if it is mapped to another one:
public static function loadClass($class)
{
if(isset($this->config['classes'][$class])) {
$class = $this->config['classes'][$class];
}
...
3.Do the same in Solar::factory():
public static function factory($class, $config = null)
{
if(isset($this->config['classes'][$class])) {
$class = $this->config['classes'][$class];
}
...
Maybe I have missed something, but if not maybe this would be simple
and nice enough?
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