3 * Data class for notice titles
9 * @author Evan Prodromou <evan@status.net>
10 * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
11 * @link http://status.net/
13 * StatusNet - the distributed open-source microblogging tool
14 * Copyright (C) 2010, StatusNet, Inc.
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.
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.
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/>.
30 if (!defined('STATUSNET')) {
34 require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
37 * Data class for notice titles
41 * @author Evan Prodromou <evan@status.net>
42 * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
43 * @link http://status.net/
47 class Notice_title extends Managed_DataObject
51 public $__table = 'notice_title'; // table name
52 public $notice_id; // int(4) primary_key not_null
53 public $title; // varchar(255)
56 * return table definition for DB_DataObject
58 * DB_DataObject needs to know something about the table to manipulate
59 * instances. This method provides all the DB_DataObject needs to know.
61 * @return array array of column definitions
65 return array('notice_id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL,
66 'title' => DB_DATAOBJECT_STR);
70 * return key definitions for DB_DataObject
72 * @return array list of key field names
76 return array_keys($this->keyTypes());
80 * return key definitions for Memcached_DataObject
82 * @return array list mapping field names to key types
86 return array('notice_id' => 'K');
90 * Magic formula for non-autoincrementing integer primary keys
92 * @return array magic three-false array that stops auto-incrementing.
94 function sequenceKey()
96 return array(false, false, false);
100 * Get a notice title based on the notice
102 * @param Notice $notice Notice to fetch a title for
104 * @return string title of the notice, or null if none
106 static function fromNotice($notice)
108 $nt = Notice_title::getKV('notice_id', $notice->id);