[Dbix-class] resultset_attributes, where, undef - wotz up?

Benjamin Martin benjamin at opusvl.com
Fri Jul 16 13:04:03 GMT 2010


Hi J,

Cool, thanks for that, now I can stop pulling my hair out trying to get 
it to work :)

So, I am going to create what is basically is a duplicate ResultSet 
(less 1 line) ... is there a nicer way to do this rather than copying 
the file and removing the line?

Thanks again,
-Ben





On 16/07/10 13:54, Jason Galea wrote:
> On Fri, Jul 16, 2010 at 6:12 PM, Benjamin Martin<benjamin at opusvl.com>  wrote:
>
>    
>>   __PACKAGE__->resultset_attributes({ where =>  { deleted =>  undef } });
>>
>> In one part of the system I would like to access these restricted records
>> but I can't seem to get it to work!
>>
>>   $schema->resultset('TableA')->search( {}, { where =>  undef } );
>>
>> Does that look OK?.. should it work?
>>
>> I have seen a post suggesting I need to create another ResultSet without the
>> 'resultset_attributes' .. which I guess would work, but it would be much
>> nicer if I could just get the '{ where =>  undef }' going.
>>
>>      
> AFAIK.. you will need to create the other ResultSet to get it to work.
> The issue is in the way the "chaining" of searches works, which is
> basically adding new conditions with an 'and' so { where =>  undef }
> doesn't change the default query set up by your resultset_attributes.
>
> calling { where =>  { deleted =>  { '!=' =>  undef } } } will just get you..
>
> ... where deleted is null and deleted is not null
>
> cheers,
>
> J
>
>    




More information about the DBIx-Class mailing list