On Tue, Jan 10, 2012 at 7:56 AM, Rob Kinyon <[email protected]> wrote:

> On Tue, Jan 10, 2012 at 08:49, Will Crawford <[email protected]>
> wrote:
> > $rs->search( \%implicit_params )->search( ... stuff passed into your
> > function ...);
>


> > On 10 January 2012 13:03, Dmitry Belyavsky <[email protected]> wrote:
> >> Greetings!
> >>
> >> I have a function similar to
> >>
> >> my $account_id = shift;
> >> my $query_params = shift;
> >>
> >> my $rs = $schema->result("Table")->search($query_params);
> >>
> >> I want to provide account-related access restrictions implicitly so I
> >> need to modify the $query_params variable. There are no problems when
> >> the $query_params is a hash reference, the code looks like
> >>
> >> my $params = {-and => [$query_params, {restrictions} ]}
> >> my $rs = $schema->result("Table")->search($query_params);
> >>
> >> How can I do it in case of the array ref passed as original params?
> >> Thank you!
>
> The key to remember here is that ->search() doesn't actually search
> anything - it's a constructor that builds a resultset from another
> resultset. A resultset is not a search. It's all the information
> necessary to build the various clauses that would go into a search.
>



> As Rob says, you don't have to munge your argument list in place, you can
keep your code as is, and then just add one more call -- see ideas here:
http://www.gossamer-threads.com/lists/catalyst/users/29449


-- 
"We act as though comfort and luxury were the chief requirements of life,
when all that we need to make us happy is something to be enthusiastic
about." -- Albert Einstein
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]

Reply via email to