[Dbix-class] DBIx::Class Relationship Setup Based on Substring
of Value in Field
Peter Rabbitson
rabbit+dbic at rabbit.us
Thu May 2 06:32:05 GMT 2013
On Wed, May 01, 2013 at 10:49:33AM -0700, stephenmoy wrote:
> Hi everybody,
>
> Does DBIx::Class allow relationships to be set up between two fields that
> are two different sizes? We have a registration table and a class table
> that are linked by term, course number, and section number. However, the
> section number in one table has three digits, while the other one has two.
I am not entirely sure I understand your requirement, but I *think* what you
are after is:
{
"$args->{foreign_alias}.term" => { -ident => "$args->{self_alias}.term" },
"$args->{foreign_alias}.crs" => { -ident => "$args->{self_alias}.crs" },
"$args->{self_alias}.sec" => \"= CAST( $args->{foreign_alias}.sec AS UNSIGNED )",
}, { and similiar for the $rowobj case }
Cheers
More information about the DBIx-Class
mailing list