[Dbix-class] schema problems...
Christopher H. Laco
claco at chrislaco.com
Wed Aug 9 14:39:43 CEST 2006
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?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://lists.rawmode.org/pipermail/dbix-class/attachments/20060809/761558dc/attachment.pgp
More information about the Dbix-class
mailing list