That won't work. I have a method that receives a resultset of Respondents and performs this sub set search.

So on occasion I want to be able to pass a resultset through to this method that has already had this sub set search performed on it and then the method does another one.

Matt S Trout wrote:
On Mon, Sep 24, 2007 at 09:04:51AM +1000, brett gardner wrote:
Well

Is there anyway to do the following.

I have a Respondent record, which has a one to many relationship with Answer records.

I want to be able to get a set of Respondents who answered a particular way and I first tried do it like

my $rs = $schema->resultset('Respondent')->search(
        {
                'answers.question_id'=>$foo,
                'answers.answer'=>$bar
        },
        {
                join=>'answers',
        }
);


Which works, but when you call search on this resultset again, ie, searching withing that subset, it fails eg

$rs = $rs->search(
        {
                'answers_2.question_id'=>$foo_1,
                'answers_2.answer'=>$bar_1,
        },{
                join=> [ 'answers', 'answers' ],
        }
);

See the resultset docs for more info about how DBIC handles multiple aliases.


_______________________________________________
List: http://lists.rawmode.org/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