3 * Table Definition for confirm_address
5 require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
7 class Confirm_address extends Managed_DataObject
10 /* the code below is auto generated do not remove the above tag */
12 public $__table = 'confirm_address'; // table name
13 public $code; // varchar(32) primary_key not_null
14 public $user_id; // int(4) not_null
15 public $address; // varchar(255) not_null
16 public $address_extra; // varchar(255) not_null
17 public $address_type; // varchar(8) not_null
18 public $claimed; // datetime()
19 public $sent; // datetime()
20 public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
23 function staticGet($k,$v=null)
24 { return Memcached_DataObject::staticGet('Confirm_address',$k,$v); }
26 /* the code above is auto generated do not remove the tag below */
29 public static function schemaDef()
33 'code' => array('type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'good random code'),
34 'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'user who requested confirmation'),
35 'address' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'address (email, xmpp, SMS, etc.)'),
36 'address_extra' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'carrier ID, for SMS'),
37 'address_type' => array('type' => 'varchar', 'length' => 8, 'not null' => true, 'description' => 'address type ("email", "xmpp", "sms")'),
38 'claimed' => array('type' => 'datetime', 'description' => 'date this was claimed for queueing'),
39 'sent' => array('type' => 'datetime', 'description' => 'date this was sent for queueing'),
40 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
42 'primary key' => array('code'),
43 'foreign keys' => array(
44 'confirm_address_user_id_fkey' => array('user', array('user_id' => 'id')),
49 static function getAddress($address, $addressType)
51 $ca = new Confirm_address();
53 $ca->address = $address;
54 $ca->address_type = $addressType;
56 if ($ca->find(true)) {
63 static function saveNew($user, $address, $addressType, $extra=null)
65 $ca = new Confirm_address();
68 $ca->user_id = $user->id;
71 $ca->address = $address;
72 $ca->address_type = $addressType;
73 $ca->address_extra = $extra;
74 $ca->code = common_confirmation_code(64);