bsw/jbe@1309: Agent= mondelefant.new_class() bsw/jbe@1309: Agent.table = 'agent' bsw/jbe@1309: Agent.primary_key = { "controlled_id", "controller_id" } bsw/jbe@1309: bsw/jbe@1309: Agent:add_reference{ bsw/jbe@1309: mode = 'm1', bsw/jbe@1309: to = "Member", bsw/jbe@1309: this_key = 'controller_id', bsw/jbe@1309: that_key = 'id', bsw/jbe@1309: ref = 'controller', bsw/jbe@1309: } bsw/jbe@1309: bsw/jbe@1309: Agent:add_reference{ bsw/jbe@1309: mode = 'm1', bsw/jbe@1309: to = "Member", bsw/jbe@1309: this_key = 'controlled_id', bsw/jbe@1309: that_key = 'id', bsw/jbe@1309: ref = 'controllee', bsw/jbe@1309: } bsw/jbe@1309: bsw/jbe@1309: function Agent:by_pk(controlled_id, controller_id) bsw/jbe@1309: return self:new_selector() bsw/jbe@1309: :add_where{ "controlled_id = ?", controlled_id } bsw/jbe@1309: :add_where{ "controller_id = ?", controller_id } bsw/jbe@1309: :optional_object_mode() bsw/jbe@1309: :exec() bsw/jbe@1309: end