webmcp

diff demo-app/model/classification.lua @ 0:9fdfb27f8e67

Version 1.0.0
author jbe/bsw
date Sun Oct 25 12:00:00 2009 +0100 (2009-10-25)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/demo-app/model/classification.lua	Sun Oct 25 12:00:00 2009 +0100
     1.3 @@ -0,0 +1,22 @@
     1.4 +Classification = mondelefant.new_class()
     1.5 +Classification.table = 'classification'
     1.6 +
     1.7 +Classification:add_reference{
     1.8 +  mode          = 'm1',         -- many (m) Classifications can refer to one (1) Medium
     1.9 +  to            = "Medium",     -- name of referenced model (quoting avoids auto-loading of model here)
    1.10 +  this_key      = 'medium_id',  -- our key in the classification table
    1.11 +  that_key      = 'id',         -- other key in the medium table
    1.12 +  ref           = 'medium',     -- name of reference
    1.13 +  back_ref      = nil,          -- not used for m1 relation!
    1.14 +  default_order = nil           -- not used for m1 relation!
    1.15 +}
    1.16 +
    1.17 +Classification:add_reference{
    1.18 +  mode          = 'm1',        -- many (m) Classifications can refer to one (1) Medium
    1.19 +  to            = "Genre",     -- name of referenced model (quoting avoids auto-loading of model here)
    1.20 +  this_key      = 'genre_id',  -- our key in the classification table
    1.21 +  that_key      = 'id',        -- other key in the genre table
    1.22 +  ref           = 'genre',     -- name of reference
    1.23 +  back_ref      = nil,         -- not used for m1 relation!
    1.24 +  default_order = nil          -- not used for m1 relation!
    1.25 +}

Impressum / About Us