Skip Menu |
 

This queue is for tickets about the DBIx-Class CPAN distribution.

Report information
The Basics
Id: 92234
Status: resolved
Priority: 0/
Queue: DBIx-Class

People
Owner: Nobody in particular
Requestors: frankschwach [...] yahoo.de
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.082801



Subject: unhelpful error message caused by error in relationship declaration
Download (untitled) / with headers
text/plain 976b
In a Result class, ommiting the "foreign" or "self" keywords for the columns that form the relationship key pair leads to a very cryptic error message, for example: __PACKAGE__->has_many( "foos", "MySchema::Result::Foo", { "foreign.bar_id" => "self.id" }, If the last line is typed as { "foreign.bar_id" => "id" }, the error message is just: Odd number of elements in anonymous hash at XXX/DBIx/Class/ResultSource.pm line 1488 which makes it really hard to locate the problem. It is caused by the DBIx::Class::ResultSource::__strip_relcond method, which just assumes that the column name must be preceeded by 'foreign' or 'self' sub __strip_relcond { +{ map { map { /^ (?:foreign|self) \. (\w+) $/x } ($_, $_[1]{$_}) } keys %{$_[1]} } } Maybe the solution would be to catch the error in DBIx::Class::ResultSource::reverse_relationship_info where __strip_relcond is called. Then the error message could point to the defective relationship.
Download (untitled) / with headers
text/plain 306b
On Fri Jan 17 16:55:34 2014, fschwach wrote: Show quoted text
> In a Result class, ommiting the "foreign" or "self" keywords for the > columns that form the relationship key pair leads to a very cryptic > error message
This has been fixed at the source with https://github.com/dbsrgits/dbix-class/commit/6909ab3cc Cheers!


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.