Re: [Dbix-class] specify join type

2009-02-19 Thread Bernhard Graf
Iain wrote: > This is what we do, however we forgot to turn off cascading on the > extra relationship e.g. > > {cascade_delete => 0, cascade_copy => 0, join_type => 'left'} > > and it caused us all kinds of fun. hehe. ;-) Is it necessary to put the cascade_* attrs on both sides, or is it enough

Re: [Dbix-class] specify join type

2009-02-19 Thread Iain
On Thu, 2009-02-19 at 18:13 +0100, Bernhard Graf wrote: > Nigel Metheringham wrote: > > > Not easily for a single query, however a relationship can have a > > join_type attribute - relationship attributes are documented in > > DBIx::Class::Relationship::Base under add_relationship > > I know this

Re: [Dbix-class] specify join type

2009-02-19 Thread Bernhard Graf
Nigel Metheringham wrote: > Not easily for a single query, however a relationship can have a > join_type attribute - relationship attributes are documented in > DBIx::Class::Relationship::Base under add_relationship I know this, but I actually wanted to use both join types. > You can always have

Re: [Dbix-class] specify join type

2009-02-19 Thread Bernhard Graf
michael reddick wrote: > something like this i think is what you're after... > > $schema->resultset('User')->search( > { items.id => { '!=' => undef }, > { > join => 'items' > group_by => 'me.id', > } > ); I think that would work, although using the "right" join type seems more natura

Re: [Dbix-class] specify join type

2009-02-19 Thread Nigel Metheringham
On 19 Feb 2009, at 16:35, Bernhard Graf wrote: Is it possible to specify the join type for the result set? Not easily for a single query, however a relationship can have a join_type attribute - relationship attributes are documented in DBIx::Class::Relationship::Base under add_relationshi

Re: [Dbix-class] specify join type

2009-02-19 Thread michael reddick
On Thu, Feb 19, 2009 at 10:35 AM, Bernhard Graf wrote: > Is it possible to specify the join type for the result set? > > E.g. I have a user who might have several items, but I want only those > users, that actually have items. > > E.g. this gives me a left join: > > $schema->resultset('User')->se

[Dbix-class] specify join type

2009-02-19 Thread Bernhard Graf
Is it possible to specify the join type for the result set? E.g. I have a user who might have several items, but I want only those users, that actually have items. E.g. this gives me a left join: $schema->resultset('User')->search( {}, { join => 'items' group_by => 'me.id', } )