[Dbix-class] Auto-joins

Darren Duncan darren at DarrenDuncan.net
Thu Mar 30 11:38:53 CEST 2006


At 09:45 +0200 30/3/06, Yuval Kogman wrote:
>On Wed, Mar 29, 2006 at 22:28:09 -0300, Nilson Santos Figueiredo Junior wrote:
>>  While reading the documentation I couldn't find any reference
>>  regarding DBIx::Class performing auto-joins. You'd always need to
>>  explicitely specify them.
>>
>>  Is there any reason preventing this from being implemented so that
>>  code like this:
>>
>>  my $rs = $schema->resultset('CD')->search(
>>      {
>>        'artist.name' => 'Bob Marley'
>>      }
>>  );
>>
>  > would work fine?
>
>SQL::Abstract is not modular enough... Please join me on irc at
>around 18:00 GMT as I'm suffering from this too and want to fix it
>=)

One way to fix it is to name your table columns such that they lend 
themselves to using natural joins.  Then you can simply say 'name' 
rather than 'artist.name', and it will work correctly and 
unambiguously.  Those kinds of joins are called 'natural' for a 
reason. -- Darren Duncan



More information about the Dbix-class mailing list