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:4b2f292a8196a5dc4a73afc078cd11cb)
13 * Database access object for the SavedSearch entity.
15 class CRM_Contact_DAO_SavedSearch
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '1.1';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_saved_search';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = FALSE;
41 * Submitted form values for this search
48 * Foreign key to civicrm_mapping used for saved search-builder searches.
55 * Foreign key to civicrm_option value table used for saved custom searches.
59 public $search_custom_id;
62 * Entity name for API based search
69 * Parameters for API based search
78 public function __construct() {
79 $this->__table
= 'civicrm_saved_search';
80 parent
::__construct();
84 * Returns localized title of this entity.
86 public static function getEntityTitle() {
87 return ts('Saved Searches');
91 * Returns foreign keys and entity references.
94 * [CRM_Core_Reference_Interface]
96 public static function getReferenceColumns() {
97 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
98 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
99 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'mapping_id', 'civicrm_mapping', 'id');
100 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
102 return Civi
::$statics[__CLASS__
]['links'];
106 * Returns all the column names of this table
110 public static function &fields() {
111 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
112 Civi
::$statics[__CLASS__
]['fields'] = [
115 'type' => CRM_Utils_Type
::T_INT
,
116 'title' => ts('Saved Search ID'),
117 'description' => ts('Saved Search ID'),
119 'where' => 'civicrm_saved_search.id',
120 'table_name' => 'civicrm_saved_search',
121 'entity' => 'SavedSearch',
122 'bao' => 'CRM_Contact_BAO_SavedSearch',
127 'name' => 'form_values',
128 'type' => CRM_Utils_Type
::T_TEXT
,
129 'title' => ts('Submitted Form Values'),
130 'description' => ts('Submitted form values for this search'),
132 'where' => 'civicrm_saved_search.form_values',
134 'table_name' => 'civicrm_saved_search',
135 'entity' => 'SavedSearch',
136 'bao' => 'CRM_Contact_BAO_SavedSearch',
138 'serialize' => self
::SERIALIZE_PHP
,
142 'name' => 'mapping_id',
143 'type' => CRM_Utils_Type
::T_INT
,
144 'title' => ts('Mapping ID'),
145 'description' => ts('Foreign key to civicrm_mapping used for saved search-builder searches.'),
146 'where' => 'civicrm_saved_search.mapping_id',
147 'table_name' => 'civicrm_saved_search',
148 'entity' => 'SavedSearch',
149 'bao' => 'CRM_Contact_BAO_SavedSearch',
151 'FKClassName' => 'CRM_Core_DAO_Mapping',
154 'search_custom_id' => [
155 'name' => 'search_custom_id',
156 'type' => CRM_Utils_Type
::T_INT
,
157 'title' => ts('Option Value ID'),
158 'description' => ts('Foreign key to civicrm_option value table used for saved custom searches.'),
159 'where' => 'civicrm_saved_search.search_custom_id',
160 'table_name' => 'civicrm_saved_search',
161 'entity' => 'SavedSearch',
162 'bao' => 'CRM_Contact_BAO_SavedSearch',
167 'name' => 'api_entity',
168 'type' => CRM_Utils_Type
::T_STRING
,
169 'title' => ts('Entity Name'),
170 'description' => ts('Entity name for API based search'),
172 'size' => CRM_Utils_Type
::HUGE
,
173 'where' => 'civicrm_saved_search.api_entity',
174 'table_name' => 'civicrm_saved_search',
175 'entity' => 'SavedSearch',
176 'bao' => 'CRM_Contact_BAO_SavedSearch',
181 'name' => 'api_params',
182 'type' => CRM_Utils_Type
::T_TEXT
,
183 'title' => ts('API Parameters'),
184 'description' => ts('Parameters for API based search'),
185 'where' => 'civicrm_saved_search.api_params',
186 'table_name' => 'civicrm_saved_search',
187 'entity' => 'SavedSearch',
188 'bao' => 'CRM_Contact_BAO_SavedSearch',
190 'serialize' => self
::SERIALIZE_JSON
,
194 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
196 return Civi
::$statics[__CLASS__
]['fields'];
200 * Return a mapping from field-name to the corresponding key (as used in fields()).
203 * Array(string $name => string $uniqueName).
205 public static function &fieldKeys() {
206 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
207 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
209 return Civi
::$statics[__CLASS__
]['fieldKeys'];
213 * Returns the names of this table
217 public static function getTableName() {
218 return self
::$_tableName;
222 * Returns if this table needs to be logged
226 public function getLog() {
231 * Returns the list of fields that can be imported
233 * @param bool $prefix
237 public static function &import($prefix = FALSE) {
238 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'saved_search', $prefix, []);
243 * Returns the list of fields that can be exported
245 * @param bool $prefix
249 public static function &export($prefix = FALSE) {
250 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'saved_search', $prefix, []);
255 * Returns the list of indices
257 * @param bool $localize
261 public static function indices($localize = TRUE) {
263 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;