Как DBIx::Class выбирать связи многие ко многим? Постоянно ругается, что "No such relationship". | Код | $c->model('DB::Foo')->search({}, {join=>{foo_bar => 'bar'}}) # - ошибка!
#Foo связанна с Bar связью многие ко многим package App::Schema::Result::Foo; __PACKAGE__->has_many('foo_bar' => 'App::Schema::Result::Foo', 'id_foo'); __PACKAGE__->many_to_many(bar => ('foo_bar', 'bar'));
package App::Schema::Result::FooBar; __PACKAGE__->belongs_to(foo => 'App::Schema::Result::Foo', 'id_foo'); __PACKAGE__->belongs_to(bar => 'App::Schema::Result::Bar', 'id_bar');
package App::Schema::Result::Bar; __PACKAGE__->has_many(foo_bar => 'App::Schema::Result::Bar', 'id_bar'); __PACKAGE__->many_to_many(foo => ('foo_bar', 'foo'));
|
|