annotate model/unit.lua @ 284:38dbcd510657
Added filter for delegating interest and support
author |
bsw |
date |
Fri Feb 17 15:14:50 2012 +0100 (2012-02-17) |
parents |
b77e6a17ca77 |
children |
c587d8762e62 |
rev |
line source |
bsw@241
|
1 Unit = mondelefant.new_class()
|
bsw@241
|
2 Unit.table = 'unit'
|
bsw@241
|
3
|
bsw@241
|
4 Unit:add_reference{
|
bsw@241
|
5 mode = '1m',
|
bsw@241
|
6 to = "Area",
|
bsw@241
|
7 this_key = 'id',
|
bsw@241
|
8 that_key = 'unit_id',
|
bsw@241
|
9 ref = 'areas',
|
bsw@241
|
10 back_ref = 'unit'
|
bsw@241
|
11 }
|
bsw@241
|
12
|
bsw@281
|
13 Unit:add_reference{
|
bsw@281
|
14 mode = 'mm',
|
bsw@281
|
15 to = "Member",
|
bsw@281
|
16 this_key = 'id',
|
bsw@281
|
17 that_key = 'id',
|
bsw@281
|
18 connected_by_table = 'privilege',
|
bsw@281
|
19 connected_by_this_key = 'unit_id',
|
bsw@281
|
20 connected_by_that_key = 'member_id',
|
bsw@281
|
21 ref = 'members'
|
bsw@281
|
22 }
|
bsw@281
|
23
|
bsw@241
|
24 function Unit:get_flattened_tree()
|
bsw@241
|
25 -- TODO implement
|
bsw@241
|
26
|
bsw@241
|
27 return Unit:new_selector():exec()
|
bsw@241
|
28 end
|