[Dbix-class] object as a value of result_class (resultset_class)
Eden Cardim
edencardim at gmail.com
Tue Sep 20 22:18:24 GMT 2011
>>>>> "Roman" == Roman Daniel <roman.daniel at davosro.cz> writes:
Roman> In my app I store instances of several classes (subclasses) in one table.
Roman> I try to implement a dispatcher which decides what class to inflate to
Roman> according to row data loaded from db.
Roman> It seems handy for this dispatcher to be an object instead of class.
Roman> In DBIC the setter for result_class is implemented via set_component_class,
Roman> which expects its argument to be a class - Class::Inspector->loaded is
Roman> called on it.
Roman> I can overwrite set_component_class to fallback to set_inherited when
Roman> its argument is a blessed object, but I am not sure whether the whole
Roman> idea is not weird. If not do you plan to allow result_class to be an
Roman> object? (it can be set to object even now but a warning is issued by
Roman> Class::Inspector)
Roman> I appreciate any comment
https://metacpan.org/module/DBIx::Class::KiokuDB does exactly what
you're trying to implement.
--
Eden Cardim
Code Monkey http://www.shadowcat.co.uk/catalyst/
Shadowcat Systems Ltd. Want a managed development or deployment platform?
http://blog.edencardim.com/ http://www.shadowcat.co.uk/servers/
http://twitter.com/#!/edenc
More information about the DBIx-Class
mailing list