Josef Chladek wrote:
> hi list,
> 
> we are porting a CDBI setup to DBIC and having the following problem:
> 
> package XMLForm::Schema::Calendar::Companies;
> use base qw/DBIx::Class/;
> __PACKAGE__->load_components(qw/Core/);
> __PACKAGE__->table('companies');
> __PACKAGE__->add_columns(qw/id name matrix_id description logo  
> website/);
> __PACKAGE__->set_primary_key('id');
> __PACKAGE__->might_have(matrix_id =>  
> 'XMLForm::Schema::Matrix::Entries');
> 1;
> 
> package XMLForm::Schema::Matrix::Entries;
> use base qw/DBIx::Class/;
> __PACKAGE__->load_components(qw/Core/);
> __PACKAGE__->table('Companies');
> __PACKAGE__->add_columns(qw/id short_name long_name tts_id/);
> __PACKAGE__->set_primary_key('id');
> __PACKAGE__->has_many(likes => 'XMLForm::Schema::Matrix::Likes',  
> 'company_id');
> 1;
> 
> then in the app:
> my $connect = "XMLForm::Model::Calendar"->config->{connect_info};
> my $model = XMLForm::Schema::Calendar->connect(@$connect);
> 
> my $rs = $model->resultset('Companies')->search(
>      {
>       'id' => 26
>      },
> );
> while (my $r = $rs->next){
>       warn $r->matrix_id;
> }
> 
> this results in
> DBIx::Class::Relationship::Accessor::__ANON__(): Can't find source  
> for XMLForm::Schema::Matrix::Entries
> 
> how can I avoid writing the Matrix schema under Calendar?
> 
> what works is
> warn $r->{_column_data}->{matrix_id};
> 
> but I don't guess that's the way it should be done?
> 
> thanks
> josef

It's early, and I'm not DBIC guru, but from looking at the code, I'm
assuming your schema class is XMLForm::Schema::Calandar? Can we see that
code?


Attachment: signature.asc
Description: OpenPGP digital signature

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

Reply via email to