5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Contact/SavedSearch.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:f84f342e55d9bbc420ff499c2789ab48)
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 * Entity name for API based search
67 * Parameters for API based search
76 public function __construct() {
77 $this->__table
= 'civicrm_saved_search';
78 parent
::__construct();
82 * Returns localized title of this entity.
84 public static function getEntityTitle() {
85 return ts('Saved Searches');
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' => 'api_entity',
162 'type' => CRM_Utils_Type
::T_STRING
,
163 'title' => ts('Entity Name'),
164 'description' => ts('Entity name for API based search'),
166 'size' => CRM_Utils_Type
::HUGE
,
167 'where' => 'civicrm_saved_search.api_entity',
168 'table_name' => 'civicrm_saved_search',
169 'entity' => 'SavedSearch',
170 'bao' => 'CRM_Contact_BAO_SavedSearch',
174 'name' => 'api_params',
175 'type' => CRM_Utils_Type
::T_TEXT
,
176 'title' => ts('API Parameters'),
177 'description' => ts('Parameters for API based search'),
178 'where' => 'civicrm_saved_search.api_params',
179 'table_name' => 'civicrm_saved_search',
180 'entity' => 'SavedSearch',
181 'bao' => 'CRM_Contact_BAO_SavedSearch',
183 'serialize' => self
::SERIALIZE_JSON
,
186 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
188 return Civi
::$statics[__CLASS__
]['fields'];
192 * Return a mapping from field-name to the corresponding key (as used in fields()).
195 * Array(string $name => string $uniqueName).
197 public static function &fieldKeys() {
198 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
199 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
201 return Civi
::$statics[__CLASS__
]['fieldKeys'];
205 * Returns the names of this table
209 public static function getTableName() {
210 return self
::$_tableName;
214 * Returns if this table needs to be logged
218 public function getLog() {
223 * Returns the list of fields that can be imported
225 * @param bool $prefix
229 public static function &import($prefix = FALSE) {
230 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'saved_search', $prefix, []);
235 * Returns the list of fields that can be exported
237 * @param bool $prefix
241 public static function &export($prefix = FALSE) {
242 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'saved_search', $prefix, []);
247 * Returns the list of indices
249 * @param bool $localize
253 public static function indices($localize = TRUE) {
255 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;