3 * Table Definition for invitation
5 require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
7 class Invitation extends Managed_DataObject
10 /* the code below is auto generated do not remove the above tag */
12 public $__table = 'invitation'; // table name
13 public $code; // varchar(32) primary_key not_null
14 public $user_id; // int(4) not_null
15 public $address; // varchar(255) multiple_key not_null
16 public $address_type; // varchar(8) multiple_key not_null
17 public $registered_user_id; // int(4) not_null
18 public $created; // datetime() not_null
21 function staticGet($k,$v=null)
22 { return Memcached_DataObject::staticGet('Invitation',$k,$v); }
24 /* the code above is auto generated do not remove the tag below */
27 function convert($user)
30 $this->registered_user_id = $user->id;
31 return $this->update($orig);
34 public static function schemaDef()
39 'code' => array('type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'random code for an invitation'),
40 'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'who sent the invitation'),
41 'address' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'invitation sent to'),
42 'address_type' => array('type' => 'varchar', 'length' => 8, 'not null' => true, 'description' => 'address type ("email", "xmpp", "sms")'),
43 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
44 'registered_user_id' => array('type' => 'int', 'not null' => false, 'description' => 'if the invitation is converted, who the new user is'),
46 'primary key' => array('code'),
47 'foreign keys' => array(
48 'invitation_user_id_fkey' => array('user', array('user_id' => 'id')),
49 'invitation_registered_user_id_fkey' => array('user', array('registered_user_id' => 'id')),
52 'invitation_address_idx' => array('address', 'address_type'),
53 'invitation_user_id_idx' => array('user_id'),
54 'invitation_registered_user_id_idx' => array('registered_user_id'),