[dev] Autoloading application rdo objects

Jan Schneider jan at horde.org
Sat Nov 7 10:36:14 UTC 2009


Zitat von Duck <duck at obala.net>:

> As the current implementation of RDO requires the object mapper to have the
> "Mapper" suffix after the object name. Hot to make them autoload-able?

I my (private) application, I name them like App_Rdo_FooMapper and  
have all the Rdo classes in the app/lib/Rdo/ directory. This only  
works for a small set of classes though, because you end up with a lot  
of files in this directory otherwise.

We should probably use a different name scheming that better fits our  
autoloading scheme. Maybe App_Rdo_Mapper_Foo so that all mapper  
classes are in app/lib/Rdo/Mapper/. Though this wouldn't group the  
classes thematically, just by function.
The other option would be App_Rdo_Foo_Mapper, but that would lead to a  
lot of app/lib/Rdo/Foo/ directories, all only containing the  
Mapper.php file.
A third solution could be to also name the Rdo base classes  
differently, so that we have App_Rdo_Foo_Mapper and App_Rdo_Foo_Base  
(or _Object). That's the cleanest solution on the filesystem level  
IMO, because we have a lib/Rdo/ directory that only contains  
directories, and all these directories group the Rdo base and mapper  
classes thematically. The resulting base class name is less beautiful  
though.

Jan.

-- 
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/



More information about the dev mailing list