Thread DBIx::Class -> has_many und belongs_to (8 answers)
Opened by bloonix at 2007-09-23 15:20

renee
 2007-09-23 17:23
#99887 #99887
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
+---------+
| foreign |
+---------+
| id (PK) |
| col1 |
+---------+

+---------+
| self |
+---------+
| sid |
| fid (FK) |
+---------+


Code (perl): (dl )
1
2
3
4
5
package MyDB::ForeignTable;

#....

__PACKAGE__->has_many( 'selfs' => 'MyDB::SelfTable', {"foreign.fid" => "self.id"});


Code (perl): (dl )
1
2
3
4
5
package MyDB::SelfTable;

#...

__PACKAGE__->belongs_to( 'foreign' => 'MyDB::ForeignTable', {'foreign.id' => 'self.fid'});
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread DBIx::Class -> has_many und belongs_to