Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
8c9251b3 | 5 | * @copyright CiviCRM LLC (c) 2004-2018 |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Contact/SavedSearch.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
2a5c9b4d | 9 | * (GenCodeChecksum:0341555885ddaf5dbc8e4d6cfe1d899c) |
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 | */ | |
22 | 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 | */ |
c3fc2621 CW |
29 | static $_log = FALSE; |
30 | ||
e501603b TO |
31 | /** |
32 | * Saved Search ID | |
33 | * | |
34 | * @var int unsigned | |
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 | * | |
48 | * @var int unsigned | |
49 | */ | |
50 | public $mapping_id; | |
c3fc2621 | 51 | |
e501603b TO |
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; | |
c3fc2621 | 58 | |
e501603b TO |
59 | /** |
60 | * the sql where clause if a saved search acl | |
61 | * | |
62 | * @var text | |
63 | */ | |
64 | public $where_clause; | |
c3fc2621 | 65 | |
e501603b TO |
66 | /** |
67 | * the tables to be included in a select data | |
68 | * | |
69 | * @var text | |
70 | */ | |
71 | public $select_tables; | |
c3fc2621 | 72 | |
e501603b TO |
73 | /** |
74 | * the tables to be included in the count statement | |
75 | * | |
76 | * @var text | |
77 | */ | |
78 | public $where_tables; | |
c3fc2621 | 79 | |
e501603b | 80 | /** |
f41f0342 | 81 | * Class constructor. |
e501603b | 82 | */ |
c3fc2621 | 83 | public function __construct() { |
e501603b TO |
84 | $this->__table = 'civicrm_saved_search'; |
85 | parent::__construct(); | |
86 | } | |
c3fc2621 | 87 | |
e501603b | 88 | /** |
f41f0342 | 89 | * Returns foreign keys and entity references. |
e501603b TO |
90 | * |
91 | * @return array | |
92 | * [CRM_Core_Reference_Interface] | |
93 | */ | |
c3fc2621 | 94 | public static function getReferenceColumns() { |
346aaaba TO |
95 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
96 | Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); | |
c3fc2621 | 97 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'mapping_id', 'civicrm_mapping', 'id'); |
346aaaba | 98 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 99 | } |
346aaaba | 100 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 101 | } |
c3fc2621 | 102 | |
e501603b TO |
103 | /** |
104 | * Returns all the column names of this table | |
105 | * | |
106 | * @return array | |
107 | */ | |
c3fc2621 | 108 | public static function &fields() { |
346aaaba | 109 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
110 | Civi::$statics[__CLASS__]['fields'] = [ |
111 | 'id' => [ | |
e501603b TO |
112 | 'name' => 'id', |
113 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 114 | 'title' => ts('Saved Search ID'), |
e501603b | 115 | 'description' => 'Saved Search ID', |
c3fc2621 | 116 | 'required' => TRUE, |
522a26c9 | 117 | 'table_name' => 'civicrm_saved_search', |
118 | 'entity' => 'SavedSearch', | |
119 | 'bao' => 'CRM_Contact_BAO_SavedSearch', | |
6a7e5e5d | 120 | 'localizable' => 0, |
c3fc2621 CW |
121 | ], |
122 | 'form_values' => [ | |
e501603b TO |
123 | 'name' => 'form_values', |
124 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 125 | 'title' => ts('Submitted Form Values'), |
e501603b | 126 | 'description' => 'Submitted form values for this search', |
c3fc2621 | 127 | 'import' => TRUE, |
e501603b TO |
128 | 'where' => 'civicrm_saved_search.form_values', |
129 | 'headerPattern' => '', | |
130 | 'dataPattern' => '', | |
c3fc2621 | 131 | 'export' => TRUE, |
522a26c9 | 132 | 'table_name' => 'civicrm_saved_search', |
133 | 'entity' => 'SavedSearch', | |
134 | 'bao' => 'CRM_Contact_BAO_SavedSearch', | |
6a7e5e5d | 135 | 'localizable' => 0, |
2a5c9b4d | 136 | 'serialize' => self::SERIALIZE_PHP, |
c3fc2621 CW |
137 | ], |
138 | 'mapping_id' => [ | |
e501603b TO |
139 | 'name' => 'mapping_id', |
140 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 141 | 'title' => ts('Mapping ID'), |
e501603b | 142 | 'description' => 'Foreign key to civicrm_mapping used for saved search-builder searches.', |
522a26c9 | 143 | 'table_name' => 'civicrm_saved_search', |
144 | 'entity' => 'SavedSearch', | |
145 | 'bao' => 'CRM_Contact_BAO_SavedSearch', | |
6a7e5e5d | 146 | 'localizable' => 0, |
e501603b | 147 | 'FKClassName' => 'CRM_Core_DAO_Mapping', |
c3fc2621 CW |
148 | ], |
149 | 'search_custom_id' => [ | |
e501603b TO |
150 | 'name' => 'search_custom_id', |
151 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 152 | 'title' => ts('Option Value ID'), |
e501603b | 153 | 'description' => 'Foreign key to civicrm_option value table used for saved custom searches.', |
522a26c9 | 154 | 'table_name' => 'civicrm_saved_search', |
155 | 'entity' => 'SavedSearch', | |
156 | 'bao' => 'CRM_Contact_BAO_SavedSearch', | |
6a7e5e5d | 157 | 'localizable' => 0, |
c3fc2621 CW |
158 | ], |
159 | 'where_clause' => [ | |
e501603b TO |
160 | 'name' => 'where_clause', |
161 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 162 | 'title' => ts('Where Clause'), |
e501603b | 163 | 'description' => 'the sql where clause if a saved search acl', |
522a26c9 | 164 | 'table_name' => 'civicrm_saved_search', |
165 | 'entity' => 'SavedSearch', | |
166 | 'bao' => 'CRM_Contact_BAO_SavedSearch', | |
6a7e5e5d | 167 | 'localizable' => 0, |
c3fc2621 CW |
168 | ], |
169 | 'select_tables' => [ | |
e501603b TO |
170 | 'name' => 'select_tables', |
171 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 172 | 'title' => ts('Select Tables'), |
e501603b | 173 | 'description' => 'the tables to be included in a select data', |
522a26c9 | 174 | 'table_name' => 'civicrm_saved_search', |
175 | 'entity' => 'SavedSearch', | |
176 | 'bao' => 'CRM_Contact_BAO_SavedSearch', | |
6a7e5e5d | 177 | 'localizable' => 0, |
2a5c9b4d | 178 | 'serialize' => self::SERIALIZE_PHP, |
c3fc2621 CW |
179 | ], |
180 | 'where_tables' => [ | |
e501603b TO |
181 | 'name' => 'where_tables', |
182 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 183 | 'title' => ts('Where Tables'), |
e501603b | 184 | 'description' => 'the tables to be included in the count statement', |
522a26c9 | 185 | 'table_name' => 'civicrm_saved_search', |
186 | 'entity' => 'SavedSearch', | |
187 | 'bao' => 'CRM_Contact_BAO_SavedSearch', | |
6a7e5e5d | 188 | 'localizable' => 0, |
2a5c9b4d | 189 | 'serialize' => self::SERIALIZE_PHP, |
c3fc2621 CW |
190 | ], |
191 | ]; | |
346aaaba | 192 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 193 | } |
346aaaba | 194 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 195 | } |
c3fc2621 | 196 | |
e501603b | 197 | /** |
bd8e0b14 | 198 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
199 | * |
200 | * @return array | |
bd8e0b14 | 201 | * Array(string $name => string $uniqueName). |
e501603b | 202 | */ |
c3fc2621 | 203 | public static function &fieldKeys() { |
bd8e0b14 TO |
204 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
205 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 206 | } |
bd8e0b14 | 207 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 208 | } |
c3fc2621 | 209 | |
e501603b TO |
210 | /** |
211 | * Returns the names of this table | |
212 | * | |
213 | * @return string | |
214 | */ | |
c3fc2621 | 215 | public static function getTableName() { |
e501603b TO |
216 | return self::$_tableName; |
217 | } | |
c3fc2621 | 218 | |
e501603b TO |
219 | /** |
220 | * Returns if this table needs to be logged | |
221 | * | |
c3fc2621 | 222 | * @return bool |
e501603b | 223 | */ |
c3fc2621 | 224 | public function getLog() { |
e501603b TO |
225 | return self::$_log; |
226 | } | |
c3fc2621 | 227 | |
e501603b TO |
228 | /** |
229 | * Returns the list of fields that can be imported | |
230 | * | |
231 | * @param bool $prefix | |
232 | * | |
233 | * @return array | |
234 | */ | |
c3fc2621 CW |
235 | public static function &import($prefix = FALSE) { |
236 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'saved_search', $prefix, []); | |
60808919 | 237 | return $r; |
e501603b | 238 | } |
c3fc2621 | 239 | |
e501603b TO |
240 | /** |
241 | * Returns the list of fields that can be exported | |
242 | * | |
243 | * @param bool $prefix | |
244 | * | |
245 | * @return array | |
246 | */ | |
c3fc2621 CW |
247 | public static function &export($prefix = FALSE) { |
248 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'saved_search', $prefix, []); | |
60808919 | 249 | return $r; |
e501603b | 250 | } |
c3fc2621 | 251 | |
e7a6b91a AS |
252 | /** |
253 | * Returns the list of indices | |
c3fc2621 CW |
254 | * |
255 | * @param bool $localize | |
256 | * | |
257 | * @return array | |
e7a6b91a AS |
258 | */ |
259 | public static function indices($localize = TRUE) { | |
c3fc2621 | 260 | $indices = []; |
e7a6b91a AS |
261 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
262 | } | |
c3fc2621 | 263 | |
e501603b | 264 | } |