liquid_feedback_frontend

diff model/contact.lua @ 0:3bfb2fcf7ab9

Version alpha1
author bsw/jbe
date Wed Nov 18 12:00:00 2009 +0100 (2009-11-18)
parents
children a9c6c11dd86c
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/model/contact.lua	Wed Nov 18 12:00:00 2009 +0100
     1.3 @@ -0,0 +1,28 @@
     1.4 +Contact = mondelefant.new_class()
     1.5 +Contact.table = 'contact'
     1.6 +Contact.primary_key = { "member_id", "other_member_id" }
     1.7 +
     1.8 +Contact:add_reference{
     1.9 +  mode          = 'm1',
    1.10 +  to            = "Member",
    1.11 +  this_key      = 'member_id',
    1.12 +  that_key      = 'id',
    1.13 +  ref           = 'member',
    1.14 +}
    1.15 +
    1.16 +Contact:add_reference{
    1.17 +  mode          = 'm1',
    1.18 +  to            = "Member",
    1.19 +  this_key      = 'other_member_id',
    1.20 +  that_key      = 'id',
    1.21 +  ref           = 'other_member',
    1.22 +}
    1.23 +
    1.24 +
    1.25 +function Contact:by_pk(member_id, other_member_id)
    1.26 +  return self:new_selector()
    1.27 +    :add_where{ "member_id = ?", member_id }
    1.28 +    :add_where{ "other_member_id = ?", other_member_id }
    1.29 +    :optional_object_mode()
    1.30 +    :exec()
    1.31 +end

Impressum / About Us