3 * Table Definition for foreign_link
5 require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
7 class Foreign_link extends Memcached_DataObject
10 /* the code below is auto generated do not remove the above tag */
12 public $__table = 'foreign_link'; // table name
13 public $user_id; // int(4) primary_key not_null
14 public $foreign_id; // bigint(8) primary_key not_null unsigned
15 public $service; // int(4) primary_key not_null
16 public $credentials; // varchar(255)
17 public $noticesync; // tinyint(1) not_null default_1
18 public $friendsync; // tinyint(1) not_null default_2
19 public $profilesync; // tinyint(1) not_null default_1
20 public $last_noticesync; // datetime()
21 public $last_friendsync; // datetime()
22 public $created; // datetime() not_null
23 public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
26 function staticGet($k,$v=null)
27 { return Memcached_DataObject::staticGet('Foreign_link',$k,$v); }
29 /* the code above is auto generated do not remove the tag below */
32 static function getByUserID($user_id, $service)
34 if (empty($user_id) || empty($service)) {
38 $flink = new Foreign_link();
40 $flink->service = $service;
41 $flink->user_id = $user_id;
44 $result = $flink->find(true);
46 return empty($result) ? null : $flink;
50 static function getByForeignID($foreign_id, $service)
52 if (empty($foreign_id) || empty($service)) {
55 $flink = new Foreign_link();
56 $flink->service = $service;
57 $flink->foreign_id = $foreign_id;
60 $result = $flink->find(true);
62 return empty($result) ? null : $flink;
66 function set_flags($noticesend, $noticerecv, $replysync, $friendsync)
69 $this->noticesync |= FOREIGN_NOTICE_SEND;
71 $this->noticesync &= ~FOREIGN_NOTICE_SEND;
75 $this->noticesync |= FOREIGN_NOTICE_RECV;
77 $this->noticesync &= ~FOREIGN_NOTICE_RECV;
81 $this->noticesync |= FOREIGN_NOTICE_SEND_REPLY;
83 $this->noticesync &= ~FOREIGN_NOTICE_SEND_REPLY;
87 $this->friendsync |= FOREIGN_FRIEND_RECV;
89 $this->friendsync &= ~FOREIGN_FRIEND_RECV;
92 $this->profilesync = 0;
96 function getForeignUser()
98 $fuser = new Foreign_user();
99 $fuser->service = $this->service;
100 $fuser->id = $this->foreign_id;
104 if ($fuser->find(true)) {
113 return User::staticGet($this->user_id);