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:d863f8b0b8659633bc84578e1d6cbf10)
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.
87 * Whether to return the plural version of the title.
89 public static function getEntityTitle($plural = FALSE) {
90 return $plural ?
ts('Saved Searches') : ts('Saved Search');
94 * Returns foreign keys and entity references.
97 * [CRM_Core_Reference_Interface]
99 public static function getReferenceColumns() {
100 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
101 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
102 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'mapping_id', 'civicrm_mapping', 'id');
103 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
105 return Civi
::$statics[__CLASS__
]['links'];
109 * Returns all the column names of this table
113 public static function &fields() {
114 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
115 Civi
::$statics[__CLASS__
]['fields'] = [
118 'type' => CRM_Utils_Type
::T_INT
,
119 'title' => ts('Saved Search ID'),
120 'description' => ts('Saved Search ID'),
122 'where' => 'civicrm_saved_search.id',
123 'table_name' => 'civicrm_saved_search',
124 'entity' => 'SavedSearch',
125 'bao' => 'CRM_Contact_BAO_SavedSearch',
130 'name' => 'form_values',
131 'type' => CRM_Utils_Type
::T_TEXT
,
132 'title' => ts('Submitted Form Values'),
133 'description' => ts('Submitted form values for this search'),
135 'where' => 'civicrm_saved_search.form_values',
137 'table_name' => 'civicrm_saved_search',
138 'entity' => 'SavedSearch',
139 'bao' => 'CRM_Contact_BAO_SavedSearch',
141 'serialize' => self
::SERIALIZE_PHP
,
145 'name' => 'mapping_id',
146 'type' => CRM_Utils_Type
::T_INT
,
147 'title' => ts('Mapping ID'),
148 'description' => ts('Foreign key to civicrm_mapping used for saved search-builder searches.'),
149 'where' => 'civicrm_saved_search.mapping_id',
150 'table_name' => 'civicrm_saved_search',
151 'entity' => 'SavedSearch',
152 'bao' => 'CRM_Contact_BAO_SavedSearch',
154 'FKClassName' => 'CRM_Core_DAO_Mapping',
157 'search_custom_id' => [
158 'name' => 'search_custom_id',
159 'type' => CRM_Utils_Type
::T_INT
,
160 'title' => ts('Option Value ID'),
161 'description' => ts('Foreign key to civicrm_option value table used for saved custom searches.'),
162 'where' => 'civicrm_saved_search.search_custom_id',
163 'table_name' => 'civicrm_saved_search',
164 'entity' => 'SavedSearch',
165 'bao' => 'CRM_Contact_BAO_SavedSearch',
170 'name' => 'api_entity',
171 'type' => CRM_Utils_Type
::T_STRING
,
172 'title' => ts('Entity Name'),
173 'description' => ts('Entity name for API based search'),
175 'size' => CRM_Utils_Type
::HUGE
,
176 'where' => 'civicrm_saved_search.api_entity',
177 'table_name' => 'civicrm_saved_search',
178 'entity' => 'SavedSearch',
179 'bao' => 'CRM_Contact_BAO_SavedSearch',
184 'name' => 'api_params',
185 'type' => CRM_Utils_Type
::T_TEXT
,
186 'title' => ts('API Parameters'),
187 'description' => ts('Parameters for API based search'),
188 'where' => 'civicrm_saved_search.api_params',
189 'table_name' => 'civicrm_saved_search',
190 'entity' => 'SavedSearch',
191 'bao' => 'CRM_Contact_BAO_SavedSearch',
193 'serialize' => self
::SERIALIZE_JSON
,
197 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
199 return Civi
::$statics[__CLASS__
]['fields'];
203 * Return a mapping from field-name to the corresponding key (as used in fields()).
206 * Array(string $name => string $uniqueName).
208 public static function &fieldKeys() {
209 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
210 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
212 return Civi
::$statics[__CLASS__
]['fieldKeys'];
216 * Returns the names of this table
220 public static function getTableName() {
221 return self
::$_tableName;
225 * Returns if this table needs to be logged
229 public function getLog() {
234 * Returns the list of fields that can be imported
236 * @param bool $prefix
240 public static function &import($prefix = FALSE) {
241 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'saved_search', $prefix, []);
246 * Returns the list of fields that can be exported
248 * @param bool $prefix
252 public static function &export($prefix = FALSE) {
253 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'saved_search', $prefix, []);
258 * Returns the list of indices
260 * @param bool $localize
264 public static function indices($localize = TRUE) {
266 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;