[Dbix-class] schema problems...
    Josef Chladek 
    j.chladek at wirtschaftsblatt.at
       
    Wed Aug  9 09:40:18 CEST 2006
    
    
  
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
    
    
More information about the Dbix-class
mailing list