CRM-20312 regenerated DAOS with indexes
[civicrm-core.git] / CRM / Contact / DAO / SavedSearch.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
26 */
27 /**
28 * @package CRM
29 * @copyright CiviCRM LLC (c) 2004-2017
30 *
31 * Generated from xml/schema/CRM/Contact/SavedSearch.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:8e799b35db1b6a38deee5a757d4183c0)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 /**
38 * CRM_Contact_DAO_SavedSearch constructor.
39 */
40 class CRM_Contact_DAO_SavedSearch extends CRM_Core_DAO {
41 /**
42 * Static instance to hold the table name.
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_saved_search';
47 /**
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
49 *
50 * @var boolean
51 */
52 static $_log = false;
53 /**
54 * Saved Search ID
55 *
56 * @var int unsigned
57 */
58 public $id;
59 /**
60 * Submitted form values for this search
61 *
62 * @var text
63 */
64 public $form_values;
65 /**
66 * Foreign key to civicrm_mapping used for saved search-builder searches.
67 *
68 * @var int unsigned
69 */
70 public $mapping_id;
71 /**
72 * Foreign key to civicrm_option value table used for saved custom searches.
73 *
74 * @var int unsigned
75 */
76 public $search_custom_id;
77 /**
78 * the sql where clause if a saved search acl
79 *
80 * @var text
81 */
82 public $where_clause;
83 /**
84 * the tables to be included in a select data
85 *
86 * @var text
87 */
88 public $select_tables;
89 /**
90 * the tables to be included in the count statement
91 *
92 * @var text
93 */
94 public $where_tables;
95 /**
96 * Class constructor.
97 */
98 function __construct() {
99 $this->__table = 'civicrm_saved_search';
100 parent::__construct();
101 }
102 /**
103 * Returns foreign keys and entity references.
104 *
105 * @return array
106 * [CRM_Core_Reference_Interface]
107 */
108 static function getReferenceColumns() {
109 if (!isset(Civi::$statics[__CLASS__]['links'])) {
110 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
111 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'mapping_id', 'civicrm_mapping', 'id');
112 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
113 }
114 return Civi::$statics[__CLASS__]['links'];
115 }
116 /**
117 * Returns all the column names of this table
118 *
119 * @return array
120 */
121 static function &fields() {
122 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
123 Civi::$statics[__CLASS__]['fields'] = array(
124 'id' => array(
125 'name' => 'id',
126 'type' => CRM_Utils_Type::T_INT,
127 'title' => ts('Saved Search ID') ,
128 'description' => 'Saved Search ID',
129 'required' => true,
130 'table_name' => 'civicrm_saved_search',
131 'entity' => 'SavedSearch',
132 'bao' => 'CRM_Contact_BAO_SavedSearch',
133 'localizable' => 0,
134 ) ,
135 'form_values' => array(
136 'name' => 'form_values',
137 'type' => CRM_Utils_Type::T_TEXT,
138 'title' => ts('Submitted Form Values') ,
139 'description' => 'Submitted form values for this search',
140 'import' => true,
141 'where' => 'civicrm_saved_search.form_values',
142 'headerPattern' => '',
143 'dataPattern' => '',
144 'export' => true,
145 'table_name' => 'civicrm_saved_search',
146 'entity' => 'SavedSearch',
147 'bao' => 'CRM_Contact_BAO_SavedSearch',
148 'localizable' => 0,
149 ) ,
150 'mapping_id' => array(
151 'name' => 'mapping_id',
152 'type' => CRM_Utils_Type::T_INT,
153 'title' => ts('Mapping ID') ,
154 'description' => 'Foreign key to civicrm_mapping used for saved search-builder searches.',
155 'table_name' => 'civicrm_saved_search',
156 'entity' => 'SavedSearch',
157 'bao' => 'CRM_Contact_BAO_SavedSearch',
158 'localizable' => 0,
159 'FKClassName' => 'CRM_Core_DAO_Mapping',
160 ) ,
161 'search_custom_id' => array(
162 'name' => 'search_custom_id',
163 'type' => CRM_Utils_Type::T_INT,
164 'title' => ts('Option Value ID') ,
165 'description' => 'Foreign key to civicrm_option value table used for saved custom searches.',
166 'table_name' => 'civicrm_saved_search',
167 'entity' => 'SavedSearch',
168 'bao' => 'CRM_Contact_BAO_SavedSearch',
169 'localizable' => 0,
170 ) ,
171 'where_clause' => array(
172 'name' => 'where_clause',
173 'type' => CRM_Utils_Type::T_TEXT,
174 'title' => ts('Where Clause') ,
175 'description' => 'the sql where clause if a saved search acl',
176 'table_name' => 'civicrm_saved_search',
177 'entity' => 'SavedSearch',
178 'bao' => 'CRM_Contact_BAO_SavedSearch',
179 'localizable' => 0,
180 ) ,
181 'select_tables' => array(
182 'name' => 'select_tables',
183 'type' => CRM_Utils_Type::T_TEXT,
184 'title' => ts('Select Tables') ,
185 'description' => 'the tables to be included in a select data',
186 'table_name' => 'civicrm_saved_search',
187 'entity' => 'SavedSearch',
188 'bao' => 'CRM_Contact_BAO_SavedSearch',
189 'localizable' => 0,
190 ) ,
191 'where_tables' => array(
192 'name' => 'where_tables',
193 'type' => CRM_Utils_Type::T_TEXT,
194 'title' => ts('Where Tables') ,
195 'description' => 'the tables to be included in the count statement',
196 'table_name' => 'civicrm_saved_search',
197 'entity' => 'SavedSearch',
198 'bao' => 'CRM_Contact_BAO_SavedSearch',
199 'localizable' => 0,
200 ) ,
201 );
202 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
203 }
204 return Civi::$statics[__CLASS__]['fields'];
205 }
206 /**
207 * Return a mapping from field-name to the corresponding key (as used in fields()).
208 *
209 * @return array
210 * Array(string $name => string $uniqueName).
211 */
212 static function &fieldKeys() {
213 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
214 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
215 }
216 return Civi::$statics[__CLASS__]['fieldKeys'];
217 }
218 /**
219 * Returns the names of this table
220 *
221 * @return string
222 */
223 static function getTableName() {
224 return self::$_tableName;
225 }
226 /**
227 * Returns if this table needs to be logged
228 *
229 * @return boolean
230 */
231 function getLog() {
232 return self::$_log;
233 }
234 /**
235 * Returns the list of fields that can be imported
236 *
237 * @param bool $prefix
238 *
239 * @return array
240 */
241 static function &import($prefix = false) {
242 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'saved_search', $prefix, array());
243 return $r;
244 }
245 /**
246 * Returns the list of fields that can be exported
247 *
248 * @param bool $prefix
249 *
250 * @return array
251 */
252 static function &export($prefix = false) {
253 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'saved_search', $prefix, array());
254 return $r;
255 }
256 /**
257 * Returns the list of indices
258 */
259 public static function indices($localize = TRUE) {
260 $indices = array();
261 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
262 }
263 }