[Dbix-class] all data at once
Dmitriy S. Sinyavskiy
dreel at bk.ru
Mon Dec 10 22:48:58 GMT 2007
Hello, Jason.
You write 10 декабря 2007 г., 23:19:41:
JG> Angel Kolev [mailto:ankolev at gmail.com] wrote:
>> Thank you.
>> It works, but only when prefetch only 1 table. If i try to do it with
JG> both:
>> my $rs = $c->model('AppModelDB::ClientFemale')->search(undef,
>> {
>> join
=>> [qw/ client_family client_male /],
>> prefetch
=>> [qw/ client_family client_male /]
>> });
>> .. the result is:
>>
>> No such relationship client_male at
JG> /usr/local/share/perl/5.8.8/DBIx/Class/Schema.pm line 945
JG> DBIx::Class::Schema::throw_exception('AppModelDB=HASH(0x927aab4)', 'No
JG> such relationship client_male'................etc
>> I only can use prefetch AppModelDB::ClientFemale -> client_family
JG> andAppModelDB::ClientMale -> client_family. The relationships are
JG> has_many and may_to_many. The "Family" table have
"_PACKAGE__->>belongs_to" for both tables.
JG> Your join and prefetch attributes must be nested hashrefs:
JG> my $rs = $c->model('AppModelDB::ClientFemale')->search(undef,
JG> { join => { client_family => 'client_male' },
JG> prefetch => { client_family => 'client_male' },
JG> {
JG> );
JG> HTH,
JG> Jason
JG> _______________________________________________
JG> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
JG> IRC: irc.perl.org#dbix-class
JG> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
JG> Searchable Archive:
JG> http://www.grokbase.com/group/dbix-class@lists.rawmode.org
You're too late ) problem was found in schema. He was trying to use
rel names not created in schema.
--
dreel mailto:dreel at bk.ru
Dmitriy S. Sinyavskiy
Web-developer Perl, Catalyst, MSSQL
FGUE EZAN Telecommunication, data transfer networks and devices.
More information about the DBIx-Class
mailing list