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:73251f9c4af0127e2e9fc2770f21869d)
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 * Unique name of saved search
48 * Administrative label for search
55 * Submitted form values for this search
62 * Foreign key to civicrm_mapping used for saved search-builder searches.
69 * Foreign key to civicrm_option value table used for saved custom searches.
73 public $search_custom_id;
76 * Entity name for API based search
83 * Parameters for API based search
92 public function __construct() {
93 $this->__table
= 'civicrm_saved_search';
94 parent
::__construct();
98 * Returns localized title of this entity.
100 * @param bool $plural
101 * Whether to return the plural version of the title.
103 public static function getEntityTitle($plural = FALSE) {
104 return $plural ?
ts('Saved Searches') : ts('Saved Search');
108 * Returns foreign keys and entity references.
111 * [CRM_Core_Reference_Interface]
113 public static function getReferenceColumns() {
114 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
115 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
116 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'mapping_id', 'civicrm_mapping', 'id');
117 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
119 return Civi
::$statics[__CLASS__
]['links'];
123 * Returns all the column names of this table
127 public static function &fields() {
128 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
129 Civi
::$statics[__CLASS__
]['fields'] = [
132 'type' => CRM_Utils_Type
::T_INT
,
133 'title' => ts('Saved Search ID'),
134 'description' => ts('Saved Search ID'),
136 'where' => 'civicrm_saved_search.id',
137 'table_name' => 'civicrm_saved_search',
138 'entity' => 'SavedSearch',
139 'bao' => 'CRM_Contact_BAO_SavedSearch',
145 'type' => CRM_Utils_Type
::T_STRING
,
146 'title' => ts('Saved Search Name'),
147 'description' => ts('Unique name of saved search'),
149 'size' => CRM_Utils_Type
::HUGE
,
150 'where' => 'civicrm_saved_search.name',
152 'table_name' => 'civicrm_saved_search',
153 'entity' => 'SavedSearch',
154 'bao' => 'CRM_Contact_BAO_SavedSearch',
163 'type' => CRM_Utils_Type
::T_STRING
,
164 'title' => ts('Saved Search Label'),
165 'description' => ts('Administrative label for search'),
167 'size' => CRM_Utils_Type
::HUGE
,
168 'where' => 'civicrm_saved_search.label',
170 'table_name' => 'civicrm_saved_search',
171 'entity' => 'SavedSearch',
172 'bao' => 'CRM_Contact_BAO_SavedSearch',
180 'name' => 'form_values',
181 'type' => CRM_Utils_Type
::T_TEXT
,
182 'title' => ts('Submitted Form Values'),
183 'description' => ts('Submitted form values for this search'),
185 'where' => 'civicrm_saved_search.form_values',
187 'table_name' => 'civicrm_saved_search',
188 'entity' => 'SavedSearch',
189 'bao' => 'CRM_Contact_BAO_SavedSearch',
191 'serialize' => self
::SERIALIZE_PHP
,
195 'name' => 'mapping_id',
196 'type' => CRM_Utils_Type
::T_INT
,
197 'title' => ts('Mapping ID'),
198 'description' => ts('Foreign key to civicrm_mapping used for saved search-builder searches.'),
199 'where' => 'civicrm_saved_search.mapping_id',
200 'table_name' => 'civicrm_saved_search',
201 'entity' => 'SavedSearch',
202 'bao' => 'CRM_Contact_BAO_SavedSearch',
204 'FKClassName' => 'CRM_Core_DAO_Mapping',
207 'search_custom_id' => [
208 'name' => 'search_custom_id',
209 'type' => CRM_Utils_Type
::T_INT
,
210 'title' => ts('Option Value ID'),
211 'description' => ts('Foreign key to civicrm_option value table used for saved custom searches.'),
212 'where' => 'civicrm_saved_search.search_custom_id',
213 'table_name' => 'civicrm_saved_search',
214 'entity' => 'SavedSearch',
215 'bao' => 'CRM_Contact_BAO_SavedSearch',
220 'name' => 'api_entity',
221 'type' => CRM_Utils_Type
::T_STRING
,
222 'title' => ts('Entity Name'),
223 'description' => ts('Entity name for API based search'),
225 'size' => CRM_Utils_Type
::HUGE
,
226 'where' => 'civicrm_saved_search.api_entity',
227 'table_name' => 'civicrm_saved_search',
228 'entity' => 'SavedSearch',
229 'bao' => 'CRM_Contact_BAO_SavedSearch',
234 'name' => 'api_params',
235 'type' => CRM_Utils_Type
::T_TEXT
,
236 'title' => ts('API Parameters'),
237 'description' => ts('Parameters for API based search'),
238 'where' => 'civicrm_saved_search.api_params',
239 'table_name' => 'civicrm_saved_search',
240 'entity' => 'SavedSearch',
241 'bao' => 'CRM_Contact_BAO_SavedSearch',
243 'serialize' => self
::SERIALIZE_JSON
,
247 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
249 return Civi
::$statics[__CLASS__
]['fields'];
253 * Return a mapping from field-name to the corresponding key (as used in fields()).
256 * Array(string $name => string $uniqueName).
258 public static function &fieldKeys() {
259 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
260 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
262 return Civi
::$statics[__CLASS__
]['fieldKeys'];
266 * Returns the names of this table
270 public static function getTableName() {
271 return self
::$_tableName;
275 * Returns if this table needs to be logged
279 public function getLog() {
284 * Returns the list of fields that can be imported
286 * @param bool $prefix
290 public static function &import($prefix = FALSE) {
291 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'saved_search', $prefix, []);
296 * Returns the list of fields that can be exported
298 * @param bool $prefix
302 public static function &export($prefix = FALSE) {
303 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'saved_search', $prefix, []);
308 * Returns the list of indices
310 * @param bool $localize
314 public static function indices($localize = TRUE) {
321 'localizable' => FALSE,
323 'sig' => 'civicrm_saved_search::1::name',
326 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;