3 * Data class to record user prefs for polls
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) 2012, 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')) {
35 * For storing the poll prefs
37 * @category PollPlugin
39 * @author Brion Vibber <brion@status.net>
40 * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
41 * @link http://status.net/
45 class User_poll_prefs extends Managed_DataObject
47 public $__table = 'user_poll_prefs'; // table name
48 public $user_id; // int id
49 public $hide_responses; // boolean
50 public $created; // datetime
51 public $modified; // datetime
54 * Get an instance by key
56 * This is a utility method to get a single instance with a given key value.
58 * @param string $k Key to use to lookup (usually 'user_id' for this class)
59 * @param mixed $v Value to lookup
61 * @return User_greeting_count object found, or null for no hits
64 function staticGet($k, $v=null)
66 return Memcached_DataObject::staticGet('User_poll_prefs', $k, $v);
70 * The One True Thingy that must be defined and declared.
72 public static function schemaDef()
75 'description' => 'Record of user preferences for polls',
77 'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'user id'),
78 'hide_responses' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'Hide all poll responses'),
79 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
80 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
82 'primary key' => array('user_id')