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:ff337d9810d6c4d6225f77b6b3007729)
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 static $_tableName = 'civicrm_saved_search';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
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 'table_name' => 'civicrm_saved_search',
118 'entity' => 'SavedSearch',
119 'bao' => 'CRM_Contact_BAO_SavedSearch',
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'),
128 'where' => 'civicrm_saved_search.form_values',
129 'headerPattern' => '',
132 'table_name' => 'civicrm_saved_search',
133 'entity' => 'SavedSearch',
134 'bao' => 'CRM_Contact_BAO_SavedSearch',
136 'serialize' => self
::SERIALIZE_PHP
,
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',
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 'table_name' => 'civicrm_saved_search',
155 'entity' => 'SavedSearch',
156 'bao' => 'CRM_Contact_BAO_SavedSearch',
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',
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',
178 'serialize' => self
::SERIALIZE_PHP
,
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',
189 'serialize' => self
::SERIALIZE_PHP
,
192 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
194 return Civi
::$statics[__CLASS__
]['fields'];
198 * Return a mapping from field-name to the corresponding key (as used in fields()).
201 * Array(string $name => string $uniqueName).
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()));
207 return Civi
::$statics[__CLASS__
]['fieldKeys'];
211 * Returns the names of this table
215 public static function getTableName() {
216 return self
::$_tableName;
220 * Returns if this table needs to be logged
224 public function getLog() {
229 * Returns the list of fields that can be imported
231 * @param bool $prefix
235 public static function &import($prefix = FALSE) {
236 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'saved_search', $prefix, []);
241 * Returns the list of fields that can be exported
243 * @param bool $prefix
247 public static function &export($prefix = FALSE) {
248 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'saved_search', $prefix, []);
253 * Returns the list of indices
255 * @param bool $localize
259 public static function indices($localize = TRUE) {
261 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;