3 * Table Definition for oauth_association
5 require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
7 class Oauth_token_association extends Memcached_DataObject
10 /* the code below is auto generated do not remove the above tag */
12 public $__table = 'oauth_token_association'; // table name
13 public $profile_id; // int(4) primary_key not_null
14 public $application_id; // int(4) primary_key not_null
15 public $token; // 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) {
21 return Memcached_DataObject::staticGet('oauth_token_association', $k, $v);
23 /* the code above is auto generated do not remove the tag below */
26 static function getByUserAndToken($user, $token)
28 if (empty($user) || empty($token)) {
32 $oau = new oauth_request_token();
34 $oau->profile_id = $user->id;
38 $result = $oau->find(true);
40 return empty($result) ? null : $oau;
43 public static function schemaDef()
46 'description' => 'Associate an application ID and profile ID with an OAuth token',
48 'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'associated user'),
49 'application_id' => array('type' => 'int', 'not null' => true, 'description' => 'the application'),
50 'token' => array('type' => 'varchar', 'length' => '255', 'not null' => true, 'description' => 'token used for this association'),
51 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
52 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
54 'primary key' => array('profile_id', 'application_id', 'token'),
55 'foreign keys' => array(
56 'oauth_token_association_profile_fkey' => array('profile_id', array('profile' => 'id')),
57 'oauth_token_association_application_fkey' => array('application_id', array('application' => 'id')),