Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
ca5cec67 | 5 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Contact/SavedSearch.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
d31fb4e3 | 9 | * (GenCodeChecksum:73251f9c4af0127e2e9fc2770f21869d) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the SavedSearch entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Contact_DAO_SavedSearch extends CRM_Core_DAO { |
929a1c14 CW |
16 | const EXT = 'civicrm'; |
17 | const TABLE_ADDED = '1.1'; | |
c3fc2621 | 18 | |
e501603b | 19 | /** |
f41f0342 | 20 | * Static instance to hold the table name. |
e501603b TO |
21 | * |
22 | * @var string | |
23 | */ | |
fa45b5b9 | 24 | public static $_tableName = 'civicrm_saved_search'; |
c3fc2621 | 25 | |
e501603b | 26 | /** |
f41f0342 | 27 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 28 | * |
c3fc2621 | 29 | * @var bool |
e501603b | 30 | */ |
fa45b5b9 | 31 | public static $_log = FALSE; |
c3fc2621 | 32 | |
e501603b TO |
33 | /** |
34 | * Saved Search ID | |
35 | * | |
e6ca0a57 | 36 | * @var int |
e501603b TO |
37 | */ |
38 | public $id; | |
c3fc2621 | 39 | |
53b13ffe CW |
40 | /** |
41 | * Unique name of saved search | |
42 | * | |
43 | * @var string | |
44 | */ | |
45 | public $name; | |
46 | ||
47 | /** | |
48 | * Administrative label for search | |
49 | * | |
50 | * @var string | |
51 | */ | |
52 | public $label; | |
53 | ||
e501603b TO |
54 | /** |
55 | * Submitted form values for this search | |
56 | * | |
57 | * @var text | |
58 | */ | |
59 | public $form_values; | |
c3fc2621 | 60 | |
e501603b TO |
61 | /** |
62 | * Foreign key to civicrm_mapping used for saved search-builder searches. | |
63 | * | |
e6ca0a57 | 64 | * @var int |
e501603b TO |
65 | */ |
66 | public $mapping_id; | |
c3fc2621 | 67 | |
e501603b TO |
68 | /** |
69 | * Foreign key to civicrm_option value table used for saved custom searches. | |
70 | * | |
e6ca0a57 | 71 | * @var int |
e501603b TO |
72 | */ |
73 | public $search_custom_id; | |
c3fc2621 | 74 | |
0d7216d3 CW |
75 | /** |
76 | * Entity name for API based search | |
77 | * | |
78 | * @var string | |
79 | */ | |
80 | public $api_entity; | |
81 | ||
82 | /** | |
83 | * Parameters for API based search | |
84 | * | |
85 | * @var text | |
86 | */ | |
87 | public $api_params; | |
88 | ||
e501603b | 89 | /** |
f41f0342 | 90 | * Class constructor. |
e501603b | 91 | */ |
c3fc2621 | 92 | public function __construct() { |
e501603b TO |
93 | $this->__table = 'civicrm_saved_search'; |
94 | parent::__construct(); | |
95 | } | |
c3fc2621 | 96 | |
449c4e6b CW |
97 | /** |
98 | * Returns localized title of this entity. | |
7b66c3b5 AH |
99 | * |
100 | * @param bool $plural | |
101 | * Whether to return the plural version of the title. | |
449c4e6b | 102 | */ |
7b66c3b5 AH |
103 | public static function getEntityTitle($plural = FALSE) { |
104 | return $plural ? ts('Saved Searches') : ts('Saved Search'); | |
449c4e6b CW |
105 | } |
106 | ||
e501603b | 107 | /** |
f41f0342 | 108 | * Returns foreign keys and entity references. |
e501603b TO |
109 | * |
110 | * @return array | |
111 | * [CRM_Core_Reference_Interface] | |
112 | */ | |
c3fc2621 | 113 | public static function getReferenceColumns() { |
346aaaba | 114 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 115 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 | 116 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'mapping_id', 'civicrm_mapping', 'id'); |
346aaaba | 117 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 118 | } |
346aaaba | 119 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 120 | } |
c3fc2621 | 121 | |
e501603b TO |
122 | /** |
123 | * Returns all the column names of this table | |
124 | * | |
125 | * @return array | |
126 | */ | |
c3fc2621 | 127 | public static function &fields() { |
346aaaba | 128 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
129 | Civi::$statics[__CLASS__]['fields'] = [ |
130 | 'id' => [ | |
e501603b TO |
131 | 'name' => 'id', |
132 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 133 | 'title' => ts('Saved Search ID'), |
215b423e | 134 | 'description' => ts('Saved Search ID'), |
c3fc2621 | 135 | 'required' => TRUE, |
a36434b9 | 136 | 'where' => 'civicrm_saved_search.id', |
522a26c9 | 137 | 'table_name' => 'civicrm_saved_search', |
138 | 'entity' => 'SavedSearch', | |
139 | 'bao' => 'CRM_Contact_BAO_SavedSearch', | |
6a7e5e5d | 140 | 'localizable' => 0, |
a9d0587b | 141 | 'add' => '1.1', |
c3fc2621 | 142 | ], |
53b13ffe CW |
143 | 'name' => [ |
144 | 'name' => 'name', | |
145 | 'type' => CRM_Utils_Type::T_STRING, | |
146 | 'title' => ts('Saved Search Name'), | |
147 | 'description' => ts('Unique name of saved search'), | |
148 | 'maxlength' => 255, | |
149 | 'size' => CRM_Utils_Type::HUGE, | |
150 | 'where' => 'civicrm_saved_search.name', | |
151 | 'default' => 'NULL', | |
152 | 'table_name' => 'civicrm_saved_search', | |
153 | 'entity' => 'SavedSearch', | |
154 | 'bao' => 'CRM_Contact_BAO_SavedSearch', | |
155 | 'localizable' => 0, | |
156 | 'html' => [ | |
157 | 'type' => 'Text', | |
158 | ], | |
159 | 'add' => '1.0', | |
160 | ], | |
161 | 'label' => [ | |
162 | 'name' => 'label', | |
163 | 'type' => CRM_Utils_Type::T_STRING, | |
164 | 'title' => ts('Saved Search Label'), | |
165 | 'description' => ts('Administrative label for search'), | |
166 | 'maxlength' => 255, | |
167 | 'size' => CRM_Utils_Type::HUGE, | |
168 | 'where' => 'civicrm_saved_search.label', | |
169 | 'default' => 'NULL', | |
170 | 'table_name' => 'civicrm_saved_search', | |
171 | 'entity' => 'SavedSearch', | |
172 | 'bao' => 'CRM_Contact_BAO_SavedSearch', | |
173 | 'localizable' => 0, | |
174 | 'html' => [ | |
175 | 'type' => 'Text', | |
176 | ], | |
177 | 'add' => '5.32', | |
178 | ], | |
c3fc2621 | 179 | 'form_values' => [ |
e501603b TO |
180 | 'name' => 'form_values', |
181 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 182 | 'title' => ts('Submitted Form Values'), |
215b423e | 183 | 'description' => ts('Submitted form values for this search'), |
c3fc2621 | 184 | 'import' => TRUE, |
e501603b | 185 | 'where' => 'civicrm_saved_search.form_values', |
c3fc2621 | 186 | 'export' => TRUE, |
522a26c9 | 187 | 'table_name' => 'civicrm_saved_search', |
188 | 'entity' => 'SavedSearch', | |
189 | 'bao' => 'CRM_Contact_BAO_SavedSearch', | |
6a7e5e5d | 190 | 'localizable' => 0, |
2a5c9b4d | 191 | 'serialize' => self::SERIALIZE_PHP, |
a9d0587b | 192 | 'add' => '1.1', |
c3fc2621 CW |
193 | ], |
194 | 'mapping_id' => [ | |
e501603b TO |
195 | 'name' => 'mapping_id', |
196 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 197 | 'title' => ts('Mapping ID'), |
215b423e | 198 | 'description' => ts('Foreign key to civicrm_mapping used for saved search-builder searches.'), |
a36434b9 | 199 | 'where' => 'civicrm_saved_search.mapping_id', |
522a26c9 | 200 | 'table_name' => 'civicrm_saved_search', |
201 | 'entity' => 'SavedSearch', | |
202 | 'bao' => 'CRM_Contact_BAO_SavedSearch', | |
6a7e5e5d | 203 | 'localizable' => 0, |
e501603b | 204 | 'FKClassName' => 'CRM_Core_DAO_Mapping', |
a9d0587b | 205 | 'add' => '1.5', |
c3fc2621 CW |
206 | ], |
207 | 'search_custom_id' => [ | |
e501603b TO |
208 | 'name' => 'search_custom_id', |
209 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 210 | 'title' => ts('Option Value ID'), |
215b423e | 211 | 'description' => ts('Foreign key to civicrm_option value table used for saved custom searches.'), |
a36434b9 | 212 | 'where' => 'civicrm_saved_search.search_custom_id', |
522a26c9 | 213 | 'table_name' => 'civicrm_saved_search', |
214 | 'entity' => 'SavedSearch', | |
215 | 'bao' => 'CRM_Contact_BAO_SavedSearch', | |
6a7e5e5d | 216 | 'localizable' => 0, |
a9d0587b | 217 | 'add' => '2.0', |
c3fc2621 | 218 | ], |
0d7216d3 CW |
219 | 'api_entity' => [ |
220 | 'name' => 'api_entity', | |
221 | 'type' => CRM_Utils_Type::T_STRING, | |
222 | 'title' => ts('Entity Name'), | |
223 | 'description' => ts('Entity name for API based search'), | |
224 | 'maxlength' => 255, | |
225 | 'size' => CRM_Utils_Type::HUGE, | |
226 | 'where' => 'civicrm_saved_search.api_entity', | |
227 | 'table_name' => 'civicrm_saved_search', | |
228 | 'entity' => 'SavedSearch', | |
229 | 'bao' => 'CRM_Contact_BAO_SavedSearch', | |
230 | 'localizable' => 0, | |
a9d0587b | 231 | 'add' => '5.24', |
0d7216d3 CW |
232 | ], |
233 | 'api_params' => [ | |
234 | 'name' => 'api_params', | |
235 | 'type' => CRM_Utils_Type::T_TEXT, | |
236 | 'title' => ts('API Parameters'), | |
237 | 'description' => ts('Parameters for API based search'), | |
238 | 'where' => 'civicrm_saved_search.api_params', | |
239 | 'table_name' => 'civicrm_saved_search', | |
240 | 'entity' => 'SavedSearch', | |
241 | 'bao' => 'CRM_Contact_BAO_SavedSearch', | |
242 | 'localizable' => 0, | |
243 | 'serialize' => self::SERIALIZE_JSON, | |
a9d0587b | 244 | 'add' => '5.24', |
0d7216d3 | 245 | ], |
c3fc2621 | 246 | ]; |
346aaaba | 247 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 248 | } |
346aaaba | 249 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 250 | } |
c3fc2621 | 251 | |
e501603b | 252 | /** |
bd8e0b14 | 253 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
254 | * |
255 | * @return array | |
bd8e0b14 | 256 | * Array(string $name => string $uniqueName). |
e501603b | 257 | */ |
c3fc2621 | 258 | public static function &fieldKeys() { |
bd8e0b14 TO |
259 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
260 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 261 | } |
bd8e0b14 | 262 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 263 | } |
c3fc2621 | 264 | |
e501603b TO |
265 | /** |
266 | * Returns the names of this table | |
267 | * | |
268 | * @return string | |
269 | */ | |
c3fc2621 | 270 | public static function getTableName() { |
e501603b TO |
271 | return self::$_tableName; |
272 | } | |
c3fc2621 | 273 | |
e501603b TO |
274 | /** |
275 | * Returns if this table needs to be logged | |
276 | * | |
c3fc2621 | 277 | * @return bool |
e501603b | 278 | */ |
c3fc2621 | 279 | public function getLog() { |
e501603b TO |
280 | return self::$_log; |
281 | } | |
c3fc2621 | 282 | |
e501603b TO |
283 | /** |
284 | * Returns the list of fields that can be imported | |
285 | * | |
286 | * @param bool $prefix | |
287 | * | |
288 | * @return array | |
289 | */ | |
c3fc2621 CW |
290 | public static function &import($prefix = FALSE) { |
291 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'saved_search', $prefix, []); | |
60808919 | 292 | return $r; |
e501603b | 293 | } |
c3fc2621 | 294 | |
e501603b TO |
295 | /** |
296 | * Returns the list of fields that can be exported | |
297 | * | |
298 | * @param bool $prefix | |
299 | * | |
300 | * @return array | |
301 | */ | |
c3fc2621 CW |
302 | public static function &export($prefix = FALSE) { |
303 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'saved_search', $prefix, []); | |
60808919 | 304 | return $r; |
e501603b | 305 | } |
c3fc2621 | 306 | |
e7a6b91a AS |
307 | /** |
308 | * Returns the list of indices | |
c3fc2621 CW |
309 | * |
310 | * @param bool $localize | |
311 | * | |
312 | * @return array | |
e7a6b91a AS |
313 | */ |
314 | public static function indices($localize = TRUE) { | |
53b13ffe CW |
315 | $indices = [ |
316 | 'UI_name' => [ | |
317 | 'name' => 'UI_name', | |
318 | 'field' => [ | |
319 | 0 => 'name', | |
320 | ], | |
321 | 'localizable' => FALSE, | |
322 | 'unique' => TRUE, | |
323 | 'sig' => 'civicrm_saved_search::1::name', | |
324 | ], | |
325 | ]; | |
e7a6b91a AS |
326 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
327 | } | |
c3fc2621 | 328 | |
e501603b | 329 | } |