fixup CRM-14885 - Import DAOs
[civicrm-core.git] / CRM / Contact / DAO / SavedSearch.php
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/Contact/SavedSearch.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:1972403bedc8ca79674ce1b7f6f3760c)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Contact_DAO_SavedSearch extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_saved_search';
44 /**
45 * static instance to hold the field values
46 *
47 * @var array
48 */
49 static $_fields = null;
50 /**
51 * static instance to hold the keys used in $_fields for each field.
52 *
53 * @var array
54 */
55 static $_fieldKeys = null;
56 /**
57 * static instance to hold the FK relationships
58 *
59 * @var string
60 */
61 static $_links = null;
62 /**
63 * static instance to hold the values that can
64 * be imported
65 *
66 * @var array
67 */
68 static $_import = null;
69 /**
70 * static instance to hold the values that can
71 * be exported
72 *
73 * @var array
74 */
75 static $_export = null;
76 /**
77 * static value to see if we should log any modifications to
78 * this table in the civicrm_log table
79 *
80 * @var boolean
81 */
82 static $_log = false;
83 /**
84 * Saved Search ID
85 *
86 * @var int unsigned
87 */
88 public $id;
89 /**
90 * Submitted form values for this search
91 *
92 * @var text
93 */
94 public $form_values;
95 /**
96 * Foreign key to civicrm_mapping used for saved search-builder searches.
97 *
98 * @var int unsigned
99 */
100 public $mapping_id;
101 /**
102 * Foreign key to civicrm_option value table used for saved custom searches.
103 *
104 * @var int unsigned
105 */
106 public $search_custom_id;
107 /**
108 * the sql where clause if a saved search acl
109 *
110 * @var text
111 */
112 public $where_clause;
113 /**
114 * the tables to be included in a select data
115 *
116 * @var text
117 */
118 public $select_tables;
119 /**
120 * the tables to be included in the count statement
121 *
122 * @var text
123 */
124 public $where_tables;
125 /**
126 * class constructor
127 *
128 * @return civicrm_saved_search
129 */
130 function __construct() {
131 $this->__table = 'civicrm_saved_search';
132 parent::__construct();
133 }
134 /**
135 * Returns foreign keys and entity references
136 *
137 * @return array
138 * [CRM_Core_Reference_Interface]
139 */
140 static function getReferenceColumns() {
141 if (!self::$_links) {
142 self::$_links = static ::createReferenceColumns(__CLASS__);
143 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'mapping_id', 'civicrm_mapping', 'id');
144 }
145 return self::$_links;
146 }
147 /**
148 * Returns all the column names of this table
149 *
150 * @return array
151 */
152 static function &fields() {
153 if (!(self::$_fields)) {
154 self::$_fields = array(
155 'id' => array(
156 'name' => 'id',
157 'type' => CRM_Utils_Type::T_INT,
158 'title' => ts('Saved Search ID') ,
159 'description' => 'Saved Search ID',
160 'required' => true,
161 ) ,
162 'form_values' => array(
163 'name' => 'form_values',
164 'type' => CRM_Utils_Type::T_TEXT,
165 'title' => ts('Submitted Form Values') ,
166 'description' => 'Submitted form values for this search',
167 'import' => true,
168 'where' => 'civicrm_saved_search.form_values',
169 'headerPattern' => '',
170 'dataPattern' => '',
171 'export' => true,
172 ) ,
173 'mapping_id' => array(
174 'name' => 'mapping_id',
175 'type' => CRM_Utils_Type::T_INT,
176 'title' => ts('Mapping ID') ,
177 'description' => 'Foreign key to civicrm_mapping used for saved search-builder searches.',
178 'FKClassName' => 'CRM_Core_DAO_Mapping',
179 ) ,
180 'search_custom_id' => array(
181 'name' => 'search_custom_id',
182 'type' => CRM_Utils_Type::T_INT,
183 'title' => ts('Option Value ID') ,
184 'description' => 'Foreign key to civicrm_option value table used for saved custom searches.',
185 ) ,
186 'where_clause' => array(
187 'name' => 'where_clause',
188 'type' => CRM_Utils_Type::T_TEXT,
189 'title' => ts('Where Clause') ,
190 'description' => 'the sql where clause if a saved search acl',
191 ) ,
192 'select_tables' => array(
193 'name' => 'select_tables',
194 'type' => CRM_Utils_Type::T_TEXT,
195 'title' => ts('Select Tables') ,
196 'description' => 'the tables to be included in a select data',
197 ) ,
198 'where_tables' => array(
199 'name' => 'where_tables',
200 'type' => CRM_Utils_Type::T_TEXT,
201 'title' => ts('Where Tables') ,
202 'description' => 'the tables to be included in the count statement',
203 ) ,
204 );
205 }
206 return self::$_fields;
207 }
208 /**
209 * Returns an array containing, for each field, the arary key used for that
210 * field in self::$_fields.
211 *
212 * @return array
213 */
214 static function &fieldKeys() {
215 if (!(self::$_fieldKeys)) {
216 self::$_fieldKeys = array(
217 'id' => 'id',
218 'form_values' => 'form_values',
219 'mapping_id' => 'mapping_id',
220 'search_custom_id' => 'search_custom_id',
221 'where_clause' => 'where_clause',
222 'select_tables' => 'select_tables',
223 'where_tables' => 'where_tables',
224 );
225 }
226 return self::$_fieldKeys;
227 }
228 /**
229 * Returns the names of this table
230 *
231 * @return string
232 */
233 static function getTableName() {
234 return self::$_tableName;
235 }
236 /**
237 * Returns if this table needs to be logged
238 *
239 * @return boolean
240 */
241 function getLog() {
242 return self::$_log;
243 }
244 /**
245 * Returns the list of fields that can be imported
246 *
247 * @param bool $prefix
248 *
249 * @return array
250 */
251 static function &import($prefix = false) {
252 if (!(self::$_import)) {
253 self::$_import = array();
254 $fields = self::fields();
255 foreach($fields as $name => $field) {
256 if (CRM_Utils_Array::value('import', $field)) {
257 if ($prefix) {
258 self::$_import['saved_search'] = & $fields[$name];
259 } else {
260 self::$_import[$name] = & $fields[$name];
261 }
262 }
263 }
264 }
265 return self::$_import;
266 }
267 /**
268 * Returns the list of fields that can be exported
269 *
270 * @param bool $prefix
271 *
272 * @return array
273 */
274 static function &export($prefix = false) {
275 if (!(self::$_export)) {
276 self::$_export = array();
277 $fields = self::fields();
278 foreach($fields as $name => $field) {
279 if (CRM_Utils_Array::value('export', $field)) {
280 if ($prefix) {
281 self::$_export['saved_search'] = & $fields[$name];
282 } else {
283 self::$_export[$name] = & $fields[$name];
284 }
285 }
286 }
287 }
288 return self::$_export;
289 }
290 }