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 | |
0d7216d3 | 9 | * (GenCodeChecksum:a60876bf99e330f6a463247686a92f31) |
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 { |
c3fc2621 | 16 | |
e501603b | 17 | /** |
f41f0342 | 18 | * Static instance to hold the table name. |
e501603b TO |
19 | * |
20 | * @var string | |
21 | */ | |
fa45b5b9 | 22 | public static $_tableName = 'civicrm_saved_search'; |
c3fc2621 | 23 | |
e501603b | 24 | /** |
f41f0342 | 25 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 26 | * |
c3fc2621 | 27 | * @var bool |
e501603b | 28 | */ |
fa45b5b9 | 29 | public static $_log = FALSE; |
c3fc2621 | 30 | |
e501603b TO |
31 | /** |
32 | * Saved Search ID | |
33 | * | |
e6ca0a57 | 34 | * @var int |
e501603b TO |
35 | */ |
36 | public $id; | |
c3fc2621 | 37 | |
e501603b TO |
38 | /** |
39 | * Submitted form values for this search | |
40 | * | |
41 | * @var text | |
42 | */ | |
43 | public $form_values; | |
c3fc2621 | 44 | |
e501603b TO |
45 | /** |
46 | * Foreign key to civicrm_mapping used for saved search-builder searches. | |
47 | * | |
e6ca0a57 | 48 | * @var int |
e501603b TO |
49 | */ |
50 | public $mapping_id; | |
c3fc2621 | 51 | |
e501603b TO |
52 | /** |
53 | * Foreign key to civicrm_option value table used for saved custom searches. | |
54 | * | |
e6ca0a57 | 55 | * @var int |
e501603b TO |
56 | */ |
57 | public $search_custom_id; | |
c3fc2621 | 58 | |
0d7216d3 CW |
59 | /** |
60 | * Entity name for API based search | |
61 | * | |
62 | * @var string | |
63 | */ | |
64 | public $api_entity; | |
65 | ||
66 | /** | |
67 | * Parameters for API based search | |
68 | * | |
69 | * @var text | |
70 | */ | |
71 | public $api_params; | |
72 | ||
e501603b | 73 | /** |
f41f0342 | 74 | * Class constructor. |
e501603b | 75 | */ |
c3fc2621 | 76 | public function __construct() { |
e501603b TO |
77 | $this->__table = 'civicrm_saved_search'; |
78 | parent::__construct(); | |
79 | } | |
c3fc2621 | 80 | |
e501603b | 81 | /** |
f41f0342 | 82 | * Returns foreign keys and entity references. |
e501603b TO |
83 | * |
84 | * @return array | |
85 | * [CRM_Core_Reference_Interface] | |
86 | */ | |
c3fc2621 | 87 | public static function getReferenceColumns() { |
346aaaba | 88 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 89 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 | 90 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'mapping_id', 'civicrm_mapping', 'id'); |
346aaaba | 91 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 92 | } |
346aaaba | 93 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 94 | } |
c3fc2621 | 95 | |
e501603b TO |
96 | /** |
97 | * Returns all the column names of this table | |
98 | * | |
99 | * @return array | |
100 | */ | |
c3fc2621 | 101 | public static function &fields() { |
346aaaba | 102 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
103 | Civi::$statics[__CLASS__]['fields'] = [ |
104 | 'id' => [ | |
e501603b TO |
105 | 'name' => 'id', |
106 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 107 | 'title' => ts('Saved Search ID'), |
215b423e | 108 | 'description' => ts('Saved Search ID'), |
c3fc2621 | 109 | 'required' => TRUE, |
a36434b9 | 110 | 'where' => 'civicrm_saved_search.id', |
522a26c9 | 111 | 'table_name' => 'civicrm_saved_search', |
112 | 'entity' => 'SavedSearch', | |
113 | 'bao' => 'CRM_Contact_BAO_SavedSearch', | |
6a7e5e5d | 114 | 'localizable' => 0, |
c3fc2621 CW |
115 | ], |
116 | 'form_values' => [ | |
e501603b TO |
117 | 'name' => 'form_values', |
118 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 119 | 'title' => ts('Submitted Form Values'), |
215b423e | 120 | 'description' => ts('Submitted form values for this search'), |
c3fc2621 | 121 | 'import' => TRUE, |
e501603b | 122 | 'where' => 'civicrm_saved_search.form_values', |
c3fc2621 | 123 | 'export' => TRUE, |
522a26c9 | 124 | 'table_name' => 'civicrm_saved_search', |
125 | 'entity' => 'SavedSearch', | |
126 | 'bao' => 'CRM_Contact_BAO_SavedSearch', | |
6a7e5e5d | 127 | 'localizable' => 0, |
2a5c9b4d | 128 | 'serialize' => self::SERIALIZE_PHP, |
c3fc2621 CW |
129 | ], |
130 | 'mapping_id' => [ | |
e501603b TO |
131 | 'name' => 'mapping_id', |
132 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 133 | 'title' => ts('Mapping ID'), |
215b423e | 134 | 'description' => ts('Foreign key to civicrm_mapping used for saved search-builder searches.'), |
a36434b9 | 135 | 'where' => 'civicrm_saved_search.mapping_id', |
522a26c9 | 136 | 'table_name' => 'civicrm_saved_search', |
137 | 'entity' => 'SavedSearch', | |
138 | 'bao' => 'CRM_Contact_BAO_SavedSearch', | |
6a7e5e5d | 139 | 'localizable' => 0, |
e501603b | 140 | 'FKClassName' => 'CRM_Core_DAO_Mapping', |
c3fc2621 CW |
141 | ], |
142 | 'search_custom_id' => [ | |
e501603b TO |
143 | 'name' => 'search_custom_id', |
144 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 145 | 'title' => ts('Option Value ID'), |
215b423e | 146 | 'description' => ts('Foreign key to civicrm_option value table used for saved custom searches.'), |
a36434b9 | 147 | 'where' => 'civicrm_saved_search.search_custom_id', |
522a26c9 | 148 | 'table_name' => 'civicrm_saved_search', |
149 | 'entity' => 'SavedSearch', | |
150 | 'bao' => 'CRM_Contact_BAO_SavedSearch', | |
6a7e5e5d | 151 | 'localizable' => 0, |
c3fc2621 | 152 | ], |
0d7216d3 CW |
153 | 'api_entity' => [ |
154 | 'name' => 'api_entity', | |
155 | 'type' => CRM_Utils_Type::T_STRING, | |
156 | 'title' => ts('Entity Name'), | |
157 | 'description' => ts('Entity name for API based search'), | |
158 | 'maxlength' => 255, | |
159 | 'size' => CRM_Utils_Type::HUGE, | |
160 | 'where' => 'civicrm_saved_search.api_entity', | |
161 | 'table_name' => 'civicrm_saved_search', | |
162 | 'entity' => 'SavedSearch', | |
163 | 'bao' => 'CRM_Contact_BAO_SavedSearch', | |
164 | 'localizable' => 0, | |
165 | ], | |
166 | 'api_params' => [ | |
167 | 'name' => 'api_params', | |
168 | 'type' => CRM_Utils_Type::T_TEXT, | |
169 | 'title' => ts('API Parameters'), | |
170 | 'description' => ts('Parameters for API based search'), | |
171 | 'where' => 'civicrm_saved_search.api_params', | |
172 | 'table_name' => 'civicrm_saved_search', | |
173 | 'entity' => 'SavedSearch', | |
174 | 'bao' => 'CRM_Contact_BAO_SavedSearch', | |
175 | 'localizable' => 0, | |
176 | 'serialize' => self::SERIALIZE_JSON, | |
177 | ], | |
c3fc2621 | 178 | ]; |
346aaaba | 179 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 180 | } |
346aaaba | 181 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 182 | } |
c3fc2621 | 183 | |
e501603b | 184 | /** |
bd8e0b14 | 185 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
186 | * |
187 | * @return array | |
bd8e0b14 | 188 | * Array(string $name => string $uniqueName). |
e501603b | 189 | */ |
c3fc2621 | 190 | public static function &fieldKeys() { |
bd8e0b14 TO |
191 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
192 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 193 | } |
bd8e0b14 | 194 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 195 | } |
c3fc2621 | 196 | |
e501603b TO |
197 | /** |
198 | * Returns the names of this table | |
199 | * | |
200 | * @return string | |
201 | */ | |
c3fc2621 | 202 | public static function getTableName() { |
e501603b TO |
203 | return self::$_tableName; |
204 | } | |
c3fc2621 | 205 | |
e501603b TO |
206 | /** |
207 | * Returns if this table needs to be logged | |
208 | * | |
c3fc2621 | 209 | * @return bool |
e501603b | 210 | */ |
c3fc2621 | 211 | public function getLog() { |
e501603b TO |
212 | return self::$_log; |
213 | } | |
c3fc2621 | 214 | |
e501603b TO |
215 | /** |
216 | * Returns the list of fields that can be imported | |
217 | * | |
218 | * @param bool $prefix | |
219 | * | |
220 | * @return array | |
221 | */ | |
c3fc2621 CW |
222 | public static function &import($prefix = FALSE) { |
223 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'saved_search', $prefix, []); | |
60808919 | 224 | return $r; |
e501603b | 225 | } |
c3fc2621 | 226 | |
e501603b TO |
227 | /** |
228 | * Returns the list of fields that can be exported | |
229 | * | |
230 | * @param bool $prefix | |
231 | * | |
232 | * @return array | |
233 | */ | |
c3fc2621 CW |
234 | public static function &export($prefix = FALSE) { |
235 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'saved_search', $prefix, []); | |
60808919 | 236 | return $r; |
e501603b | 237 | } |
c3fc2621 | 238 | |
e7a6b91a AS |
239 | /** |
240 | * Returns the list of indices | |
c3fc2621 CW |
241 | * |
242 | * @param bool $localize | |
243 | * | |
244 | * @return array | |
e7a6b91a AS |
245 | */ |
246 | public static function indices($localize = TRUE) { | |
c3fc2621 | 247 | $indices = []; |
e7a6b91a AS |
248 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
249 | } | |
c3fc2621 | 250 | |
e501603b | 251 | } |