Upgrade age_asof_date to datepicker in search
[civicrm-core.git] / CRM / Contact / DAO / SavedSearch.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Contact/SavedSearch.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:ff337d9810d6c4d6225f77b6b3007729)
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 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 static $_log = FALSE;
30
31 /**
32 * Saved Search ID
33 *
34 * @var int unsigned
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 unsigned
49 */
50 public $mapping_id;
51
52 /**
53 * Foreign key to civicrm_option value table used for saved custom searches.
54 *
55 * @var int unsigned
56 */
57 public $search_custom_id;
58
59 /**
60 * the sql where clause if a saved search acl
61 *
62 * @var text
63 */
64 public $where_clause;
65
66 /**
67 * the tables to be included in a select data
68 *
69 * @var text
70 */
71 public $select_tables;
72
73 /**
74 * the tables to be included in the count statement
75 *
76 * @var text
77 */
78 public $where_tables;
79
80 /**
81 * Class constructor.
82 */
83 public function __construct() {
84 $this->__table = 'civicrm_saved_search';
85 parent::__construct();
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 'table_name' => 'civicrm_saved_search',
118 'entity' => 'SavedSearch',
119 'bao' => 'CRM_Contact_BAO_SavedSearch',
120 'localizable' => 0,
121 ],
122 'form_values' => [
123 'name' => 'form_values',
124 'type' => CRM_Utils_Type::T_TEXT,
125 'title' => ts('Submitted Form Values'),
126 'description' => ts('Submitted form values for this search'),
127 'import' => TRUE,
128 'where' => 'civicrm_saved_search.form_values',
129 'headerPattern' => '',
130 'dataPattern' => '',
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 ],
138 'mapping_id' => [
139 'name' => 'mapping_id',
140 'type' => CRM_Utils_Type::T_INT,
141 'title' => ts('Mapping ID'),
142 'description' => ts('Foreign key to civicrm_mapping used for saved search-builder searches.'),
143 'table_name' => 'civicrm_saved_search',
144 'entity' => 'SavedSearch',
145 'bao' => 'CRM_Contact_BAO_SavedSearch',
146 'localizable' => 0,
147 'FKClassName' => 'CRM_Core_DAO_Mapping',
148 ],
149 'search_custom_id' => [
150 'name' => 'search_custom_id',
151 'type' => CRM_Utils_Type::T_INT,
152 'title' => ts('Option Value ID'),
153 'description' => ts('Foreign key to civicrm_option value table used for saved custom searches.'),
154 'table_name' => 'civicrm_saved_search',
155 'entity' => 'SavedSearch',
156 'bao' => 'CRM_Contact_BAO_SavedSearch',
157 'localizable' => 0,
158 ],
159 'where_clause' => [
160 'name' => 'where_clause',
161 'type' => CRM_Utils_Type::T_TEXT,
162 'title' => ts('Where Clause'),
163 'description' => ts('the sql where clause if a saved search acl'),
164 'table_name' => 'civicrm_saved_search',
165 'entity' => 'SavedSearch',
166 'bao' => 'CRM_Contact_BAO_SavedSearch',
167 'localizable' => 0,
168 ],
169 'select_tables' => [
170 'name' => 'select_tables',
171 'type' => CRM_Utils_Type::T_TEXT,
172 'title' => ts('Select Tables'),
173 'description' => ts('the tables to be included in a select data'),
174 'table_name' => 'civicrm_saved_search',
175 'entity' => 'SavedSearch',
176 'bao' => 'CRM_Contact_BAO_SavedSearch',
177 'localizable' => 0,
178 'serialize' => self::SERIALIZE_PHP,
179 ],
180 'where_tables' => [
181 'name' => 'where_tables',
182 'type' => CRM_Utils_Type::T_TEXT,
183 'title' => ts('Where Tables'),
184 'description' => ts('the tables to be included in the count statement'),
185 'table_name' => 'civicrm_saved_search',
186 'entity' => 'SavedSearch',
187 'bao' => 'CRM_Contact_BAO_SavedSearch',
188 'localizable' => 0,
189 'serialize' => self::SERIALIZE_PHP,
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 }