From: Bogdan Lucaciu Date: Tue, 1 Aug 2006 21:55:13 +0000 (+0000) Subject: Documentation patch, related to joins, aliases and 'me' X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=28bc733b35c0b1014cfa31d661edde65485b280f;p=dbsrgits%2FDBIx-Class-Historic.git Documentation patch, related to joins, aliases and 'me' --- diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index b9c2948..13d0d76 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -1809,6 +1809,19 @@ For example: } ); +You need to use the relationship (not the table) name in conditions, +because they are aliased as such. The current table is aliased as "me", so +you need to use me.column_name in order to avoid ambiguity. For example: + + # Get CDs from 1984 with a 'Foo' track + my $rs = $schema->resultset('CD')->search( + { + 'me.year' => 1984, + 'tracks.name' => 'Foo' + }, + { join => 'tracks' } + ); + If the same join is supplied twice, it will be aliased to _2 (and similarly for a third time). For e.g.