[Dbix-class] Help with relationships
Jason Kaskel
terrapinjay at gmail.com
Sat May 5 00:57:48 GMT 2007
I'm in full head banging mode now. And I'm not talking about rock!
The simplified version of my problem:
Variant Class:
package JAK::Schema::Variant;
# Created by DBIx::Class::Schema::Loader v0.03009 @ 2007-05-04 15:38:46
use strict;
use warnings;
use base 'DBIx::Class';
__PACKAGE__->load_components("PK::Auto", "Core");
__PACKAGE__->table("variant");
__PACKAGE__->add_columns(
"variant_id",
{ data_type =3D> "INT", default_value =3D> undef, is_nullable =3D> 0, siz=
e =3D> 11
},
"game",
{ data_type =3D> "ENUM", default_value =3D> undef, is_nullable =3D> 1, si=
ze =3D>
16 },
"scenario",
{ data_type =3D> "ENUM", default_value =3D> undef, is_nullable =3D> 1, si=
ze =3D>
15 },
"goal",
{
data_type =3D> "VARCHAR",
default_value =3D> "10,10,10,10",
is_nullable =3D> 0,
size =3D> 32,
},
);
__PACKAGE__->has_many("meetings" =3D> "JAK::Schema::Meeting");
__PACKAGE__->set_primary_key("variant_id");
1;
Meeting Class:
package JAK::Schema::Meeting;
# Created by DBIx::Class::Schema::Loader v0.03009 @ 2007-05-04 18:48:46
use strict;
use warnings;
use base 'DBIx::Class';
__PACKAGE__->load_components("PK::Auto", "Core");
__PACKAGE__->table("meeting");
__PACKAGE__->add_columns(
"meeting_id",
{ data_type =3D> "INT", default_value =3D> undef, is_nullable =3D> 0, siz=
e =3D> 11
},
"start_time",
{
data_type =3D> "DATETIME",
default_value =3D> "0000-00-00 00:00:00",
is_nullable =3D> 0,
size =3D> 19,
},
"variant",
{ data_type =3D> "INT", default_value =3D> 0, is_nullable =3D> 0, size =
=3D> 11 },
"synopsis",
{
data_type =3D> "TEXT",
default_value =3D> undef,
is_nullable =3D> 1,
size =3D> 65535,
},
);
__PACKAGE__->belongs_to("variant" =3D> "JAK::Schema::Variant");
__PACKAGE__->set_primary_key("meeting_id");
1;
Code that just won't work:
my $rs =3D $JAK::schema->resultset('Meeting')->search(
{ 'meeting_id' =3D> "1" },
{ join =3D> 'variant' },
);
When I try to access $rs->next, it keeps telling me:
No such relationship variant
What idiotic thing am I doing wrong?
-- =
-Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20070504/ec3=
49df7/attachment.htm
More information about the Dbix-class
mailing list