[Dbix-class] Molesting Schemas
Christopher H. Laco
claco at chrislaco.com
Mon Jun 5 19:03:06 CEST 2006
Matt S Trout wrote:
> Christopher H. Laco wrote:
>> As part of the new Handel stuff, I'm trying to provide as much ability
>> as possible of using an existing schema instead of just relying on the
>> default Handel schema.
>> As part of this process, I'm 'injecting' custom component classes into
>> the specified schema using load_components. Currently, this operates on
>> the classes themselves using $schema_class->class($cart_class).
>> The evil in this is that fact that once I inject Handel components into
>> the schema classes, they will effect the use of the schema outside of
>> Handel. This is somewhat of a Bad Thing.
>> So, my question is two fold: First, is it possible to load_component a
>> new component into a source instance only, not its class, in a way that
>> it will only effect the current source/schema instance, and not all
>> usages of the source class?
>> $schema_instance->class($cart_class) does not have "Foo" loaded?
> No, because this happens at the class level.
> OTOH you *could* quite happily take the user schema, compose_namespace
> it to somewhere else (like e.g. Catalyst::Model::DBIC::Schema does) and
> then inject stuff into the classes in the composed version, which will
> have no effect whatsoever on the originals.
Very true, although that only solves the problem for people who specify
a schema_class, and I create the schema_instance. For people who
actually pass in their existing schema_instance, my only choice is to
work in its original classes.
The the latter picture is still somewhat unclear until I get the Storage
subclassing vs. storage instance worked out. Also, when working with an
existing schema_instance, all I really need from it is the existing
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://lists.rawmode.org/pipermail/dbix-class/attachments/20060605/1559448f/attachment.pgp
More information about the Dbix-class