YanoRyuichi.com/
Wiki
Blog
GitHub
Sandbox
開始行:
* テーブル結合 基本 [#jb2d77b1]
MyApp::Schema::Result::Itemのテーブルクラスを以下のように...
__PACKAGE__->belongs_to(
'category', # ...
'MyApp::Schema::Result::Category', # ...
{ 'foreign.category_id' => 'self.category_id' } # ...
); # ...
# '...
以下のように結合先を呼べる。
say $item->category->category_name;
categoryがテーブルクラスで指定したアクセサ名。
** 参考 [#x5760564]
http://search.cpan.org/perldoc?DBIx::Class::Relationship
終了行:
* テーブル結合 基本 [#jb2d77b1]
MyApp::Schema::Result::Itemのテーブルクラスを以下のように...
__PACKAGE__->belongs_to(
'category', # ...
'MyApp::Schema::Result::Category', # ...
{ 'foreign.category_id' => 'self.category_id' } # ...
); # ...
# '...
以下のように結合先を呼べる。
say $item->category->category_name;
categoryがテーブルクラスで指定したアクセサ名。
** 参考 [#x5760564]
http://search.cpan.org/perldoc?DBIx::Class::Relationship
ページ名: