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