1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
   |  
Order:
  actAs: { Timestampable: ~ }
  columns:
    customer_id:       { type: integer, notnull: true}
    secure_key:        { type: string(32), notnull: true }
    payment:           { type: string(64), notnull: true, default: 'free' }
    total_discount:    { type: decimal, notnull: true, default: 0 }
    total_paid:        { type: decimal, notnull: true, default: 0 }
  relations:
    Customer:         { local: customer_id, foreign: id, foreignAlias: Orders, foreignType: Many }
 
State:
  columns:
    name:             { type: string(64), notnull: true }
    invoice:          { type: boolean, notnull: true, default: 0 }
    send_email:       { type: boolean, notnull: true, default: 0 }
  relations:
    Orders:
      refClass:       Order_history
      class:          Order
      local:          state_id
      foreign:        order_id
      foreignAlias:   States
 
Order_history:
  actAs: { Timestampable: ~ }
  columns:
    order_id:       { type: integer, notnull: true }
    state_id: { type: integer, notnull: true }
  relations:
    Order:          { local: order_id, foreign: id, foreignAlias: Histories }
    State:    { local: state_id, foreign: id, foreignAlias: Histories } | 
Partager