]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - classes/Sms_carrier.php
Our URLs are permanent redirects, mind you!
[quix0rs-gnu-social.git] / classes / Sms_carrier.php
1 <?php
2 /**
3  * Table Definition for sms_carrier
4  */
5 require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
6
7 class Sms_carrier extends Managed_DataObject
8 {
9     ###START_AUTOCODE
10     /* the code below is auto generated do not remove the above tag */
11
12     public $__table = 'sms_carrier';                     // table name
13     public $id;                              // int(4)  primary_key not_null
14     public $name;                            // varchar(64)  unique_key
15     public $email_pattern;                   // varchar(191)   not_null   not 255 because utf8mb4 takes more space
16     public $created;                         // datetime()   not_null
17     public $modified;                        // timestamp()   not_null default_CURRENT_TIMESTAMP
18
19     /* the code above is auto generated do not remove the tag below */
20     ###END_AUTOCODE
21
22     function toEmailAddress($sms)
23     {
24         return sprintf($this->email_pattern, $sms);
25     }
26
27     public static function schemaDef()
28     {
29         return array(
30             'fields' => array(
31                 'id' => array('type' => 'int', 'not null' => true, 'description' => 'primary key for SMS carrier'),
32                 'name' => array('type' => 'varchar', 'length' => 64, 'description' => 'name of the carrier'),
33                 'email_pattern' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'sprintf pattern for making an email address from a phone number'),
34                 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
35                 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
36             ),
37             'primary key' => array('id'),
38             'unique keys' => array(
39                 'sms_carrier_name_key' => array('name'),
40             ),
41         );
42     }
43 }