Add comment blocks
[civicrm-core.git] / CRM / Mailing / DAO / MailingGroup.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
0f03f337 6| Copyright CiviCRM LLC (c) 2004-2017 |
e501603b
TO
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
0f03f337 29 * @copyright CiviCRM LLC (c) 2004-2017
e501603b
TO
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';
e501603b
TO
44 /**
45 * static value to see if we should log any modifications to
46 * this table in the civicrm_log table
47 *
48 * @var boolean
49 */
50 static $_log = false;
51 /**
52 *
53 * @var int unsigned
54 */
55 public $id;
56 /**
57 * The ID of a previous mailing to include/exclude recipients.
58 *
59 * @var int unsigned
60 */
61 public $mailing_id;
62 /**
63 * Are the members of the group included or excluded?.
64 *
65 * @var string
66 */
67 public $group_type;
68 /**
69 * Name of table where item being referenced is stored.
70 *
71 * @var string
72 */
73 public $entity_table;
74 /**
75 * Foreign key to the referenced item.
76 *
77 * @var int unsigned
78 */
79 public $entity_id;
80 /**
81 * The filtering search. custom search id or -1 for civicrm api search
82 *
83 * @var int
84 */
85 public $search_id;
86 /**
87 * The arguments to be sent to the search function
88 *
89 * @var text
90 */
91 public $search_args;
92 /**
93 * class constructor
94 *
95 * @return civicrm_mailing_group
96 */
97 function __construct() {
98 $this->__table = 'civicrm_mailing_group';
99 parent::__construct();
100 }
101 /**
102 * Returns foreign keys and entity references
103 *
104 * @return array
105 * [CRM_Core_Reference_Interface]
106 */
107 static function getReferenceColumns() {
346aaaba
TO
108 if (!isset(Civi::$statics[__CLASS__]['links'])) {
109 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
110 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'mailing_id', 'civicrm_mailing', 'id');
111 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table');
112 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 113 }
346aaaba 114 return Civi::$statics[__CLASS__]['links'];
e501603b
TO
115 }
116 /**
117 * Returns all the column names of this table
118 *
119 * @return array
120 */
121 static function &fields() {
346aaaba
TO
122 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
123 Civi::$statics[__CLASS__]['fields'] = array(
e501603b
TO
124 'id' => array(
125 'name' => 'id',
126 'type' => CRM_Utils_Type::T_INT,
127 'title' => ts('Mailing Group ID') ,
128 'required' => true,
129 ) ,
130 'mailing_id' => array(
131 'name' => 'mailing_id',
132 'type' => CRM_Utils_Type::T_INT,
133 'title' => ts('Mailing') ,
134 'description' => 'The ID of a previous mailing to include/exclude recipients.',
135 'required' => true,
136 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
137 ) ,
138 'group_type' => array(
139 'name' => 'group_type',
140 'type' => CRM_Utils_Type::T_STRING,
141 'title' => ts('Mailing Group Type') ,
142 'description' => 'Are the members of the group included or excluded?.',
143 'maxlength' => 8,
144 'size' => CRM_Utils_Type::EIGHT,
145 'html' => array(
146 'type' => 'Select',
147 ) ,
148 'pseudoconstant' => array(
149 'callback' => 'CRM_Core_SelectValues::getMailingGroupTypes',
150 )
151 ) ,
152 'entity_table' => array(
153 'name' => 'entity_table',
154 'type' => CRM_Utils_Type::T_STRING,
155 'title' => ts('Mailing Group Entity Table') ,
156 'description' => 'Name of table where item being referenced is stored.',
157 'required' => true,
158 'maxlength' => 64,
159 'size' => CRM_Utils_Type::BIG,
160 'pseudoconstant' => array(
161 'callback' => 'CRM_Mailing_BAO_Mailing::mailingGroupEntityTables',
162 )
163 ) ,
164 'entity_id' => array(
165 'name' => 'entity_id',
166 'type' => CRM_Utils_Type::T_INT,
167 'title' => ts('Mailing Group Entity') ,
168 'description' => 'Foreign key to the referenced item.',
169 'required' => true,
170 ) ,
171 'search_id' => array(
172 'name' => 'search_id',
173 'type' => CRM_Utils_Type::T_INT,
174 'title' => ts('Mailing Group Search') ,
175 'description' => 'The filtering search. custom search id or -1 for civicrm api search',
176 ) ,
177 'search_args' => array(
178 'name' => 'search_args',
179 'type' => CRM_Utils_Type::T_TEXT,
180 'title' => ts('Mailing Group Search Arguments') ,
181 'description' => 'The arguments to be sent to the search function',
182 ) ,
183 );
346aaaba 184 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 185 }
346aaaba 186 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
187 }
188 /**
bd8e0b14 189 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
190 *
191 * @return array
bd8e0b14 192 * Array(string $name => string $uniqueName).
e501603b
TO
193 */
194 static function &fieldKeys() {
bd8e0b14
TO
195 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
196 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 197 }
bd8e0b14 198 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
199 }
200 /**
201 * Returns the names of this table
202 *
203 * @return string
204 */
205 static function getTableName() {
206 return self::$_tableName;
207 }
208 /**
209 * Returns if this table needs to be logged
210 *
211 * @return boolean
212 */
213 function getLog() {
214 return self::$_log;
215 }
216 /**
217 * Returns the list of fields that can be imported
218 *
219 * @param bool $prefix
220 *
221 * @return array
222 */
223 static function &import($prefix = false) {
60808919
TO
224 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_group', $prefix, array());
225 return $r;
e501603b
TO
226 }
227 /**
228 * Returns the list of fields that can be exported
229 *
230 * @param bool $prefix
231 *
232 * @return array
233 */
234 static function &export($prefix = false) {
60808919
TO
235 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_group', $prefix, array());
236 return $r;
e501603b
TO
237 }
238}