]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - classes/Invitation.php
Return dynamically generated URLs for thumbnails for all locally stored entries
[quix0rs-gnu-social.git] / classes / Invitation.php
1 <?php
2 /**
3  * Table Definition for invitation
4  */
5 require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
6
7 class Invitation extends Managed_DataObject
8 {
9     ###START_AUTOCODE
10     /* the code below is auto generated do not remove the above tag */
11
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(191)  multiple_key not_null   not 255 because utf8mb4 takes more space
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
19
20     /* the code above is auto generated do not remove the tag below */
21     ###END_AUTOCODE
22
23     function convert($user)
24     {
25         $orig = clone($this);
26         $this->registered_user_id = $user->id;
27         return $this->update($orig);
28     }
29
30     public static function schemaDef()
31     {
32         return array(
33
34             'fields' => array(
35                 'code' => array('type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'random code for an invitation'),
36                 'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'who sent the invitation'),
37                 'address' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'invitation sent to'),
38                 'address_type' => array('type' => 'varchar', 'length' => 8, 'not null' => true, 'description' => 'address type ("email", "xmpp", "sms")'),
39                 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
40                 'registered_user_id' => array('type' => 'int', 'not null' => false, 'description' => 'if the invitation is converted, who the new user is'),
41             ),
42             'primary key' => array('code'),
43             'foreign keys' => array(
44                 'invitation_user_id_fkey' => array('user', array('user_id' => 'id')),
45                 'invitation_registered_user_id_fkey' => array('user', array('registered_user_id' => 'id')),
46             ),
47             'indexes' => array(
48                 'invitation_address_idx' => array('address', 'address_type'),
49                 'invitation_user_id_idx' => array('user_id'),
50                 'invitation_registered_user_id_idx' => array('registered_user_id'),
51             ),
52         );
53     }
54 }