1 package DBIx::Class::CDBICompat::MightHave;
7 my ($class, $rel, $f_class, @columns) = @_;
8 my ($pri, $too_many) = keys %{ $class->_primaries };
9 $class->throw( "might_have only works with a single primary key; ${class} has more" )
12 ($f_pri, $too_many) = keys %{ $f_class->_primaries };
13 $class->throw( "might_have only works with a single primary key; ${f_class} has more" )
15 $class->add_relationship($rel, $f_class,
16 { "foreign.${f_pri}" => "self.${pri}" },
17 { accessor => 'single', proxy => \@columns,
18 cascade_update => 1, cascade_delete => 1 });