3 * Table Definition for group_alias
5 * StatusNet - the distributed open-source microblogging tool
6 * Copyright (C) 2009, StatusNet, Inc.
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Affero General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Affero General Public License for more details.
18 * You should have received a copy of the GNU Affero General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
24 require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
26 class Group_alias extends Managed_DataObject
29 /* the code below is auto generated do not remove the above tag */
31 public $__table = 'group_alias'; // table name
32 public $alias; // varchar(64) primary_key not_null
33 public $group_id; // int(4) not_null
34 public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
36 /* the code above is auto generated do not remove the tag below */
39 public static function schemaDef()
43 'alias' => array('type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'additional nickname for the group'),
44 'group_id' => array('type' => 'int', 'not null' => true, 'description' => 'group profile is blocked from'),
45 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date alias was created'),
47 'primary key' => array('alias'),
48 'foreign keys' => array(
49 'group_alias_group_id_fkey' => array('user_group', array('group_id' => 'id')),
52 'group_alias_group_id_idx' => array('group_id'),
57 public function getProfile()
59 $group = User_group::getKV('id', $this->group_id);
60 if (!($group instanceof User_group)) {
61 return null; // TODO: Throw exception when other code is ready
63 return $group->getProfile();