]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/YammerImport/classes/Yammer_notice.php
Merge branch '0.9.x'
[quix0rs-gnu-social.git] / plugins / YammerImport / classes / Yammer_notice.php
1 <?php
2 /**
3  * Data class for remembering Yammer import mappings
4  *
5  * PHP version 5
6  *
7  * @category Data
8  * @package  StatusNet
9  * @author   Brion Vibber <brion@status.net>
10  * @license  http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
11  * @link     http://status.net/
12  *
13  * StatusNet - the distributed open-source microblogging tool
14  * Copyright (C) 2010, StatusNet, Inc.
15  *
16  * This program is free software: you can redistribute it and/or modify
17  * it under the terms of the GNU Affero General Public License as published by
18  * the Free Software Foundation, either version 3 of the License, or
19  * (at your option) any later version.
20  *
21  * This program is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the
24  * GNU Affero General Public License for more details.
25  *
26  * You should have received a copy of the GNU Affero General Public License
27  * along with this program. If not, see <http://www.gnu.org/licenses/>.
28  */
29
30 if (!defined('STATUSNET')) {
31     exit(1);
32 }
33
34 class Yammer_notice extends Yammer_common
35 {
36     public $__table = 'yammer_notice'; // table name
37     public $__field = 'notice_id';     // field to map to
38     public $notice_id;                 // int
39
40     /**
41      * Get an instance by key
42      *
43      * This is a utility method to get a single instance with a given key value.
44      *
45      * @param string $k Key to use to lookup
46      * @param mixed  $v Value to lookup
47      *
48      * @return Yammer_notice object found, or null for no hits
49      *
50      */
51
52     function staticGet($k, $v=null)
53     {
54         return Memcached_DataObject::staticGet('Yammer_notice', $k, $v);
55     }
56
57     /**
58      * Return schema definition to set this table up in onCheckSchema
59      */
60
61     static function schemaDef()
62     {
63         return self::doSchemaDef('notice_id');
64     }
65
66     /**
67      * Save a mapping between a remote Yammer and local imported notice.
68      *
69      * @param integer $orig_id ID of the notice in Yammer
70      * @param integer $notice_id ID of the status in StatusNet
71      *
72      * @return Yammer_notice new object for this value
73      */
74
75     static function record($orig_id, $notice_id)
76     {
77         return self::doRecord('Yammer_notice', 'notice_id', $orig_id, $notice_id);
78     }
79 }