5 * @copyright CiviCRM LLC (c) 2004-2019
7 * Generated from xml/schema/CRM/Contact/SavedSearch.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:0b26e371ea12eb1b8a948c28ba923d32)
13 * Database access object for the SavedSearch entity.
15 class CRM_Contact_DAO_SavedSearch
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_saved_search';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = FALSE;
39 * Submitted form values for this search
46 * Foreign key to civicrm_mapping used for saved search-builder searches.
53 * Foreign key to civicrm_option value table used for saved custom searches.
57 public $search_custom_id;
60 * the sql where clause if a saved search acl
67 * the tables to be included in a select data
71 public $select_tables;
74 * the tables to be included in the count statement
83 public function __construct() {
84 $this->__table
= 'civicrm_saved_search';
85 parent
::__construct();
89 * Returns foreign keys and entity references.
92 * [CRM_Core_Reference_Interface]
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']);
100 return Civi
::$statics[__CLASS__
]['links'];
104 * Returns all the column names of this table
108 public static function &fields() {
109 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
110 Civi
::$statics[__CLASS__
]['fields'] = [
113 'type' => CRM_Utils_Type
::T_INT
,
114 'title' => ts('Saved Search ID'),
115 'description' => ts('Saved Search ID'),
117 'where' => 'civicrm_saved_search.id',
118 'table_name' => 'civicrm_saved_search',
119 'entity' => 'SavedSearch',
120 'bao' => 'CRM_Contact_BAO_SavedSearch',
124 'name' => 'form_values',
125 'type' => CRM_Utils_Type
::T_TEXT
,
126 'title' => ts('Submitted Form Values'),
127 'description' => ts('Submitted form values for this search'),
129 'where' => 'civicrm_saved_search.form_values',
131 'table_name' => 'civicrm_saved_search',
132 'entity' => 'SavedSearch',
133 'bao' => 'CRM_Contact_BAO_SavedSearch',
135 'serialize' => self
::SERIALIZE_PHP
,
138 'name' => 'mapping_id',
139 'type' => CRM_Utils_Type
::T_INT
,
140 'title' => ts('Mapping ID'),
141 'description' => ts('Foreign key to civicrm_mapping used for saved search-builder searches.'),
142 'where' => 'civicrm_saved_search.mapping_id',
143 'table_name' => 'civicrm_saved_search',
144 'entity' => 'SavedSearch',
145 'bao' => 'CRM_Contact_BAO_SavedSearch',
147 'FKClassName' => 'CRM_Core_DAO_Mapping',
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 'where' => 'civicrm_saved_search.search_custom_id',
155 'table_name' => 'civicrm_saved_search',
156 'entity' => 'SavedSearch',
157 'bao' => 'CRM_Contact_BAO_SavedSearch',
161 'name' => 'where_clause',
162 'type' => CRM_Utils_Type
::T_TEXT
,
163 'title' => ts('Where Clause'),
164 'description' => ts('the sql where clause if a saved search acl'),
165 'where' => 'civicrm_saved_search.where_clause',
166 'table_name' => 'civicrm_saved_search',
167 'entity' => 'SavedSearch',
168 'bao' => 'CRM_Contact_BAO_SavedSearch',
172 'name' => 'select_tables',
173 'type' => CRM_Utils_Type
::T_TEXT
,
174 'title' => ts('Select Tables'),
175 'description' => ts('the tables to be included in a select data'),
176 'where' => 'civicrm_saved_search.select_tables',
177 'table_name' => 'civicrm_saved_search',
178 'entity' => 'SavedSearch',
179 'bao' => 'CRM_Contact_BAO_SavedSearch',
181 'serialize' => self
::SERIALIZE_PHP
,
184 'name' => 'where_tables',
185 'type' => CRM_Utils_Type
::T_TEXT
,
186 'title' => ts('Where Tables'),
187 'description' => ts('the tables to be included in the count statement'),
188 'where' => 'civicrm_saved_search.where_tables',
189 'table_name' => 'civicrm_saved_search',
190 'entity' => 'SavedSearch',
191 'bao' => 'CRM_Contact_BAO_SavedSearch',
193 'serialize' => self
::SERIALIZE_PHP
,
196 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
198 return Civi
::$statics[__CLASS__
]['fields'];
202 * Return a mapping from field-name to the corresponding key (as used in fields()).
205 * Array(string $name => string $uniqueName).
207 public static function &fieldKeys() {
208 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
209 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
211 return Civi
::$statics[__CLASS__
]['fieldKeys'];
215 * Returns the names of this table
219 public static function getTableName() {
220 return self
::$_tableName;
224 * Returns if this table needs to be logged
228 public function getLog() {
233 * Returns the list of fields that can be imported
235 * @param bool $prefix
239 public static function &import($prefix = FALSE) {
240 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'saved_search', $prefix, []);
245 * Returns the list of fields that can be exported
247 * @param bool $prefix
251 public static function &export($prefix = FALSE) {
252 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'saved_search', $prefix, []);
257 * Returns the list of indices
259 * @param bool $localize
263 public static function indices($localize = TRUE) {
265 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;