1 package DBIx::Class::Relationship::HasOne;
7 shift->_has_one('LEFT' => @_);
11 shift->_has_one(undef => @_);
15 my ($class, $join_type, $rel, $f_class, $cond, $attrs) = @_;
17 my ($pri, $too_many) = keys %{ $class->_primaries };
18 $class->throw( "might_have/has_one can only infer join for a single primary key; ${class} has more" )
21 if ($f_class->_columns->{$rel}) {
24 ($f_key, $too_many) = keys %{ $f_class->_primaries };
25 $class->throw( "might_have/has_one can only infer join for a single primary key; ${f_class} has more" )
28 $cond = { "foreign.${f_key}" => "self.${pri}" };
30 $class->add_relationship($rel, $f_class,
32 { accessor => 'single',
33 cascade_update => 1, cascade_delete => 1,
34 ($join_type ? ('join_type' => $join_type) : ()),