]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - classes/Oauth_token_association.php
Merge branch '1.0.x' of git://gitorious.org/statusnet/mainline
[quix0rs-gnu-social.git] / classes / Oauth_token_association.php
1 <?php
2 /**
3  * Table Definition for oauth_association
4  */
5 require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
6
7 class Oauth_token_association extends Memcached_DataObject
8 {
9     ###START_AUTOCODE
10     /* the code below is auto generated do not remove the above tag */
11
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
18
19     /* Static get */
20     function staticGet($k, $v = NULL) {
21         return Memcached_DataObject::staticGet('oauth_token_association', $k, $v);
22     }
23     /* the code above is auto generated do not remove the tag below */
24     ###END_AUTOCODE
25
26     static function getByUserAndToken($user, $token)
27     {
28         if (empty($user) || empty($token)) {
29             return null;
30         }
31
32         $oau = new oauth_request_token();
33
34         $oau->profile_id = $user->id;
35         $oau->token      = $token;
36         $oau->limit(1);
37
38         $result = $oau->find(true);
39
40         return empty($result) ? null : $oau;
41     }
42 }