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