CRM-19130 - xml/templates/dao.tpl - Fire events for fields() and links()
[civicrm-core.git] / CRM / Mailing / DAO / MailingGroup.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
6| Copyright CiviCRM LLC (c) 2004-2016 |
7+--------------------------------------------------------------------+
8| This file is a part of CiviCRM. |
9| |
10| CiviCRM is free software; you can copy, modify, and distribute it |
11| under the terms of the GNU Affero General Public License |
12| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13| |
14| CiviCRM is distributed in the hope that it will be useful, but |
15| WITHOUT ANY WARRANTY; without even the implied warranty of |
16| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17| See the GNU Affero General Public License for more details. |
18| |
19| You should have received a copy of the GNU Affero General Public |
20| License and the CiviCRM Licensing Exception along |
21| with this program; if not, contact CiviCRM LLC |
22| at info[AT]civicrm[DOT]org. If you have questions about the |
23| GNU Affero General Public License or the licensing of CiviCRM, |
24| see the CiviCRM license FAQ at http://civicrm.org/licensing |
25+--------------------------------------------------------------------+
26*/
27/**
28 * @package CRM
29 * @copyright CiviCRM LLC (c) 2004-2016
30 *
31 * Generated from xml/schema/CRM/Mailing/MailingGroup.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
437fafcf 33 * (GenCodeChecksum:da1368978867c9bcae28f74bdf76f199)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
37class CRM_Mailing_DAO_MailingGroup extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_mailing_group';
44 /**
45 * static instance to hold the field values
46 *
47 * @var array
48 */
49 static $_fields = null;
e501603b
TO
50 /**
51 * static instance to hold the FK relationships
52 *
53 * @var string
54 */
55 static $_links = null;
e501603b
TO
56 /**
57 * static value to see if we should log any modifications to
58 * this table in the civicrm_log table
59 *
60 * @var boolean
61 */
62 static $_log = false;
63 /**
64 *
65 * @var int unsigned
66 */
67 public $id;
68 /**
69 * The ID of a previous mailing to include/exclude recipients.
70 *
71 * @var int unsigned
72 */
73 public $mailing_id;
74 /**
75 * Are the members of the group included or excluded?.
76 *
77 * @var string
78 */
79 public $group_type;
80 /**
81 * Name of table where item being referenced is stored.
82 *
83 * @var string
84 */
85 public $entity_table;
86 /**
87 * Foreign key to the referenced item.
88 *
89 * @var int unsigned
90 */
91 public $entity_id;
92 /**
93 * The filtering search. custom search id or -1 for civicrm api search
94 *
95 * @var int
96 */
97 public $search_id;
98 /**
99 * The arguments to be sent to the search function
100 *
101 * @var text
102 */
103 public $search_args;
104 /**
105 * class constructor
106 *
107 * @return civicrm_mailing_group
108 */
109 function __construct() {
110 $this->__table = 'civicrm_mailing_group';
111 parent::__construct();
112 }
113 /**
114 * Returns foreign keys and entity references
115 *
116 * @return array
117 * [CRM_Core_Reference_Interface]
118 */
119 static function getReferenceColumns() {
120 if (!self::$_links) {
121 self::$_links = static ::createReferenceColumns(__CLASS__);
122 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'mailing_id', 'civicrm_mailing', 'id');
123 self::$_links[] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table');
124 }
125 return self::$_links;
126 }
127 /**
128 * Returns all the column names of this table
129 *
130 * @return array
131 */
132 static function &fields() {
133 if (!(self::$_fields)) {
134 self::$_fields = array(
135 'id' => array(
136 'name' => 'id',
137 'type' => CRM_Utils_Type::T_INT,
138 'title' => ts('Mailing Group ID') ,
139 'required' => true,
140 ) ,
141 'mailing_id' => array(
142 'name' => 'mailing_id',
143 'type' => CRM_Utils_Type::T_INT,
144 'title' => ts('Mailing') ,
145 'description' => 'The ID of a previous mailing to include/exclude recipients.',
146 'required' => true,
147 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
148 ) ,
149 'group_type' => array(
150 'name' => 'group_type',
151 'type' => CRM_Utils_Type::T_STRING,
152 'title' => ts('Mailing Group Type') ,
153 'description' => 'Are the members of the group included or excluded?.',
154 'maxlength' => 8,
155 'size' => CRM_Utils_Type::EIGHT,
156 'html' => array(
157 'type' => 'Select',
158 ) ,
159 'pseudoconstant' => array(
160 'callback' => 'CRM_Core_SelectValues::getMailingGroupTypes',
161 )
162 ) ,
163 'entity_table' => array(
164 'name' => 'entity_table',
165 'type' => CRM_Utils_Type::T_STRING,
166 'title' => ts('Mailing Group Entity Table') ,
167 'description' => 'Name of table where item being referenced is stored.',
168 'required' => true,
169 'maxlength' => 64,
170 'size' => CRM_Utils_Type::BIG,
171 'pseudoconstant' => array(
172 'callback' => 'CRM_Mailing_BAO_Mailing::mailingGroupEntityTables',
173 )
174 ) ,
175 'entity_id' => array(
176 'name' => 'entity_id',
177 'type' => CRM_Utils_Type::T_INT,
178 'title' => ts('Mailing Group Entity') ,
179 'description' => 'Foreign key to the referenced item.',
180 'required' => true,
181 ) ,
182 'search_id' => array(
183 'name' => 'search_id',
184 'type' => CRM_Utils_Type::T_INT,
185 'title' => ts('Mailing Group Search') ,
186 'description' => 'The filtering search. custom search id or -1 for civicrm api search',
187 ) ,
188 'search_args' => array(
189 'name' => 'search_args',
190 'type' => CRM_Utils_Type::T_TEXT,
191 'title' => ts('Mailing Group Search Arguments') ,
192 'description' => 'The arguments to be sent to the search function',
193 ) ,
194 );
195 }
196 return self::$_fields;
197 }
198 /**
bd8e0b14 199 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
200 *
201 * @return array
bd8e0b14 202 * Array(string $name => string $uniqueName).
e501603b
TO
203 */
204 static function &fieldKeys() {
bd8e0b14
TO
205 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
206 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 207 }
bd8e0b14 208 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
209 }
210 /**
211 * Returns the names of this table
212 *
213 * @return string
214 */
215 static function getTableName() {
216 return self::$_tableName;
217 }
218 /**
219 * Returns if this table needs to be logged
220 *
221 * @return boolean
222 */
223 function getLog() {
224 return self::$_log;
225 }
226 /**
227 * Returns the list of fields that can be imported
228 *
229 * @param bool $prefix
230 *
231 * @return array
232 */
233 static function &import($prefix = false) {
60808919
TO
234 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_group', $prefix, array());
235 return $r;
e501603b
TO
236 }
237 /**
238 * Returns the list of fields that can be exported
239 *
240 * @param bool $prefix
241 *
242 * @return array
243 */
244 static function &export($prefix = false) {
60808919
TO
245 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_group', $prefix, array());
246 return $r;
e501603b
TO
247 }
248}