3 * Table Definition for user_username
5 require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
7 class User_username extends Memcached_DataObject
10 /* the code below is auto generated do not remove the above tag */
12 public $__table = 'user_username'; // table name
13 public $user_id; // int(4) not_null
14 public $provider_name; // varchar(255) primary_key not_null
15 public $username; // varchar(255) primary_key not_null
16 public $created; // datetime() not_null
17 public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
20 function staticGet($k,$v=null)
22 return Memcached_DataObject::staticGet('User_username',$k,$v);
25 /* the code above is auto generated do not remove the tag below */
29 * Register a user with a username on a given provider
30 * @param User User object
31 * @param string username on the given provider
32 * @param provider_name string name of the provider
33 * @return mixed User_username instance if the registration succeeded, false if it did not
35 static function register($user, $username, $provider_name)
37 $user_username = new User_username();
38 $user_username->user_id = $user->id;
39 $user_username->provider_name = $provider_name;
40 $user_username->username = $username;
41 $user_username->created = DB_DataObject_Cast::dateTime();
43 if($user_username->insert()){
44 return $user_username;
52 'user_id' => DB_DATAOBJECT_INT,
53 'username' => DB_DATAOBJECT_STR,
54 'provider_name' => DB_DATAOBJECT_STR ,
55 'created' => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME
59 // now define the keys.
61 return array('provider_name' => 'K', 'username' => 'K');