Hi everybody,

I'm having some problems using together (in the same result class) the DynamicSubclass and Preview components. Maybe someone can point out what's going on (and maybe someone can point out how to solve it :)).

I have a result class Item, with three subclasses: Service, Component and Bundle. In the parent class, i need to use the Preview component, as follows:

###########################################

package MyApp::Schema::Items;

use base qw/DBIx::Class/;

__PACKAGE__->load_components(qw/
    Preview DynamicSubclass Core
/);

__PACKAGE__->table('items');

__PACKAGE__->typecast_map( item_type => {
    SERVICE   => 'MyApp::Schema::Items::Service',
    COMPONENT => 'MyApp::Schema::Items::Component',
    BUNDLE    => 'MyApp::Schema::Items::Bundle',
});

...

##############################################

The error appears when doing, with preview_schema activated:

$c->model('MyApp::Schema::Items')->create(\%item_stuff);

returning the following error:

DBIx::Class::ResultSet::create(): No such column 'deleted' at ...


I've tried to change the order when loading components:

__PACKAGE__->load_components(qw/
    DynamicSubclass Preview Core
/);

but it continues crashing in the same way... I've also tried not loading the Preview component in the parent class but in the subclasses, and in that way it doesn't crash, but i got the inserts in the non-previewed table :(

Has this happened to anyone else? Please let me know if more info would be needed to find out what's happening...

Attached there is a minimal test case you can use to test it and play with. You can run the script test.pl, and it will create a testing sqlite2 database and the two required tables (items and items_preview), and then will trigger the error.

Thank you very much. Best regards,

--
Miquel Ruiz

Attachment: test_preview.tar.gz
Description: application/gzip

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]

Reply via email to