3 * Table Definition for foreign_user
5 require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
7 class Foreign_user extends Memcached_DataObject
10 /* the code below is auto generated do not remove the above tag */
12 public $__table = 'foreign_user'; // table name
13 public $id; // bigint(8) primary_key not_null
14 public $service; // int(4) primary_key not_null
15 public $uri; // varchar(255) unique_key not_null
16 public $nickname; // varchar(255)
17 public $created; // datetime() not_null
18 public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
21 function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Foreign_user',$k,$v); }
23 /* the code above is auto generated do not remove the tag below */
26 // XXX: This only returns a 1->1 single obj mapping. Change? Or make
27 // a getForeignUsers() that returns more than one? --Zach
28 static function getForeignUser($id, $service) {
29 $fuser = new Foreign_user();
30 $fuser->whereAdd("service = $service");
31 $fuser->whereAdd("id = $id");
42 static function getByNickname($nickname, $service)
44 if (empty($nickname) || empty($service)) {
47 $fuser = new Foreign_user();
48 $fuser->service = $service;
49 $fuser->nickname = $nickname;
52 $result = $fuser->find(true);
54 return empty($result) ? null : $fuser;
58 function updateKeys(&$orig)
62 foreach (array('id', 'service', 'uri', 'nickname') as $k) {
63 if (strcmp($this->$k, $orig->$k) != 0) {
64 $parts[] = $k . ' = ' . $this->_quote($this->$k);
67 if (count($parts) == 0) {
71 $toupdate = implode(', ', $parts);
73 $table = $this->tableName();
74 if(common_config('db','quote_identifiers')) {
75 $table = '"' . $table . '"';
77 $qry = 'UPDATE ' . $table . ' SET ' . $toupdate .
78 ' WHERE id = ' . $this->id;
80 $result = $this->query($qry);