On 29/04/2010 23:04, Matt S Trout wrote:
Do your subclasses have their own columns?
Yes, they have.
I'm thinking that the source for the preview stuff doesn't know about
extra columns?
Certainly this is going to be an interaction between the way preview works
and the reblessing approach. Though I'd expect them to work togethere fine
provided they wrap new() etc. - unless you've got extra columns in the
sub-classes. Though in that case, I think adding the columns to the preview
source should do the trick.
Just to try to solve it in the testing code, i have moved the
subclasses' extra columns to the parent class, but it is still not working:
$ cat lib/MyApp/Schema/Items.pm
package MyApp::Schema::Items;
use strict;
use warnings;
use Carp;
use base qw/DBIx::Class/;
__PACKAGE__->load_components(qw/
Preview DynamicSubclass Core
/);
__PACKAGE__->table('items');
__PACKAGE__->add_columns(qw/ item_id item_type cost margin opex capex /);
__PACKAGE__->set_primary_key(qw/item_id/);
__PACKAGE__->typecast_map( item_type => {
SERVICE => 'MyApp::Schema::Items::Service',
COMPONENT => 'MyApp::Schema::Items::Component',
BUNDLE => 'MyApp::Schema::Items::Bundle',
});
1;
$ cat lib/MyApp/Schema/Items/*
package MyApp::Schema::Items::Bundle;
use strict;
use warnings;
use base 'MyApp::Schema::Items';
1;
package MyApp::Schema::Items::Component;
use strict;
use warnings;
use base 'MyApp::Schema::Items';
1;
package MyApp::Schema::Items::Service;
use strict;
use warnings;
use base 'MyApp::Schema::Items';
1;
Just to make it clearer: the 'deleted' column which the error is
complaining about is not part of the app model, it is the 'deleted'
column needed by Preview to work.
Thanks for your feedback. Regards,
--
Miquel Ruiz - CAPSiDE
_______________________________________________
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]