On Sat, Nov 11, 2006 at 01:17:17AM +0000, Josef Karthauser wrote:
> my $rs = $c->model('Contact')->
> search($criteria,
> { page => $page, rows => 10,
> order_by => [$order_by, $default_order,
> "domains.domainname"],
> #1 prefetch => { 'domains' }
> #2 prefetch => { 'domains' =>
> #2 { 'self.contactid' => 'foreign.registrant',
> #2 'self.owner' => 'foreign.owner' }}
> });
>
> Neither of #1 or #2 appear to do what I want. I get 'No such
> relationship' whenever I try and process the request.
>
Ahha, got it.
What I wanted was:
my $rs = $c->model('Contact')->
search($criteria,
{ page => $page, rows => 10,
order_by => [$order_by, $default_order, "domains.domainname"],
prefetch => 'domains'
}
});
This now works, as the relationships are correctly described in the
class files. However I would have thought that #2 should have
worked too; I'd appreciate some understanding on that count. The
self. and foreign. functionality I don't think is clearly deliniated
in the documentation. (For instance when I read that I assumed
that I needed to replace self with the local table name and foreign
with the foreign table name, but that didn't work).
Joe
--
Josef Karthauser ([EMAIL PROTECTED]) http://www.josef-k.net/
Physics Particle Theory (student) http://www.pact.cpes.sussex.ac.uk/
================ An eclectic mix of fact and theory. =================
pgp1wPHF6pM9E.pgp
Description: PGP signature
_______________________________________________ List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class Wiki: http://dbix-class.shadowcatsystems.co.uk/ IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/ Searchable Archive: http://www.mail-archive.com/[email protected]/
