Dmitriy S. Sinyavskiy wrote:
Hello, Jason.
You write 10 декабря 2007 г., 23:19:41:
JG> Angel Kolev [mailto:[EMAIL PROTECTED] 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/[EMAIL PROTECTED]
You're too late ) problem was found in schema. He was trying to use
rel names not created in schema.
Hi again, Dmitriy
Thank you for help. Guess what, i need help now to populate these 3 bases :)
Is this right way:
my $rs = $c->model('AppModelDB::Family')->search({family_id => undef});
$rs->populate([{city => $city,state=>$state}]);
$c->stash->{test} = $rs->count;
Code above update my family table successfully, but i want to update all
bases at once+ 2 more colums (male_id,female_id) to be equal to family_id.
Best regards
_______________________________________________
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]