[Dbix-class] BUG? Unable to resolve relationship
Ovid
publiustemp-dbic at yahoo.com
Fri Dec 11 15:34:48 GMT 2009
--- On Fri, 11/12/09, Rob Kinyon <rob.kinyon at gmail.com> wrote:
> From: Rob Kinyon <rob.kinyon at gmail.com>
> This looks to be the mythical "might_belong_to"
> relationship type that
> hasn't been defined yet. might_have is the LEFT JOIN
> version of
> has_many. What you want is belongs_to( ..., { join_type
> => 'LEFT' } );
>From DBIx::Class::RelationShip:
might_have
Arguments: $accessor_name, $related_class, $their_fk_column|\%cond|\@cond?, \%attrs?
Creates an optional one-to-one relationship with a class.
That "one-to-one" is wrong? Is this a doc error? Ironically, our original code had "belongs_to", but it seemed a bit odd and was throwing the same error, so I changed it to "might_have" since (customer "might_have" account seemed natural).
In the sample code I sent, changing "might_have" to "belongs_to" results in the same error:
The::Schema::Customer::account(): Unable to resolve relationship from Customer to account: column account.account_id not loaded from storage (or not passed to new() prior to insert()). Maybe you forgot to call ->discard_changes to get defaults from the db. at loader.pl line 37
Cheers,
Ovid
--
Buy the book - http://www.oreilly.com/catalog/perlhks/
Tech blog - http://use.perl.org/~Ovid/journal/
Twitter - http://twitter.com/OvidPerl
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6
More information about the DBIx-Class
mailing list