12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
- require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
- class User_username extends Managed_DataObject
- {
-
-
- public $__table = 'user_username';
- public $user_id;
- public $provider_name;
- public $username;
- public $created;
- public $modified;
-
-
- public static function schemaDef()
- {
- return array(
- 'fields' => array(
- 'provider_name' => array('type' => 'varchar', 'length' => 191, 'description' => 'provider name'),
- 'username' => array('type' => 'varchar', 'length' => 191, 'description' => 'username'),
- 'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'notice id this title relates to'),
- 'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
- 'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
- ),
- 'primary key' => array('provider_name', 'username'),
- 'indexes' => array(
- 'user_id_idx' => array('user_id')
- ),
- 'foreign keys' => array(
- 'user_username_user_id_fkey' => array('user', array('user_id' => 'id')),
- ),
- );
- }
-
- static function register($user, $username, $provider_name)
- {
- $user_username = new User_username();
- $user_username->user_id = $user->id;
- $user_username->provider_name = $provider_name;
- $user_username->username = $username;
- $user_username->created = common_sql_now();
- if($user_username->insert()){
- return $user_username;
- }else{
- return false;
- }
- }
- }
|