annotate demo-app/model/genre.lua @ 460:ffdfd54ba881
Bugfix in method check
author |
jbe |
date |
Tue Jul 26 16:00:02 2016 +0200 (2016-07-26) |
parents |
9fdfb27f8e67 |
children |
|
rev |
line source |
jbe/bsw@0
|
1 Genre = mondelefant.new_class()
|
jbe/bsw@0
|
2 Genre.table = 'genre'
|
jbe/bsw@0
|
3
|
jbe/bsw@0
|
4 Genre:add_reference{
|
jbe/bsw@0
|
5 mode = '1m', -- one (1) Genre is used for many (m) Classifications
|
jbe/bsw@0
|
6 to = "Classification", -- name of referenced model (using a string instead of reference avoids auto-loading here)
|
jbe/bsw@0
|
7 this_key = 'id', -- own key in genre table
|
jbe/bsw@0
|
8 that_key = 'genre_id', -- other key in classification table
|
jbe/bsw@0
|
9 ref = 'classifications', -- name of reference
|
jbe/bsw@0
|
10 back_ref = 'genre', -- each autoloaded Classification automatically refers back to the Genre
|
jbe/bsw@0
|
11 default_order = '"media_id"' -- order Classifications by SQL expression "media_id"
|
jbe/bsw@0
|
12 }
|
jbe/bsw@0
|
13
|
jbe/bsw@0
|
14 Genre:add_reference{
|
jbe/bsw@0
|
15 mode = 'mm', -- many (m) Genres belong to many (m) Medium entries
|
jbe/bsw@0
|
16 to = "Medium", -- name of referenced model (quoting avoids auto-loading here)
|
jbe/bsw@0
|
17 this_key = 'id', -- (primary) key of genre table
|
jbe/bsw@0
|
18 that_key = 'id', -- (primary) key of medium talbe
|
jbe/bsw@0
|
19 connected_by_table = 'classification', -- table connecting genres with media
|
jbe/bsw@0
|
20 connected_by_this_key = 'genre_id', -- key in connection table referencing genres
|
jbe/bsw@0
|
21 connected_by_that_key = 'medium_id', -- key in connection table referencing media
|
jbe/bsw@0
|
22 ref = 'media', -- name of reference
|
jbe/bsw@0
|
23 back_ref = nil, -- not used for mm relation!
|
jbe/bsw@0
|
24 default_order = '"medium"."name", "medium"."id"' -- mm references need qualified names in SQL order expression!
|
jbe/bsw@0
|
25 }
|