]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - classes/Oauth_application_user.php
Merge branch 'master' of gitorious.org:statusnet/mainline into feedfix
[quix0rs-gnu-social.git] / classes / Oauth_application_user.php
1 <?php
2 /**
3  * Table Definition for oauth_application_user
4  */
5 require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
6
7 class Oauth_application_user 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_application_user';          // table name
13     public $profile_id;                      // int(4)  primary_key not_null
14     public $application_id;                  // int(4)  primary_key not_null
15     public $access_type;                     // tinyint(1)
16     public $token;                           // varchar(255)
17     public $created;                         // datetime   not_null
18     public $modified;                        // timestamp   not_null default_CURRENT_TIMESTAMP
19
20     /* Static get */
21     function staticGet($k,$v=NULL) {
22         return Memcached_DataObject::staticGet('Oauth_application_user',$k,$v);
23     }
24     /* the code above is auto generated do not remove the tag below */
25     ###END_AUTOCODE
26
27     static function getByKeys($user, $app)
28     {
29         if (empty($user) || empty($app)) {
30             return null;
31         }
32
33         $oau = new Oauth_application_user();
34
35         $oau->profile_id     = $user->id;
36         $oau->application_id = $app->id;
37         $oau->limit(1);
38
39         $result = $oau->find(true);
40
41         return empty($result) ? null : $oau;
42     }
43 }