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:4093fd1cfa684e54d609528d8df160ca)
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',
125 'name' => 'form_values',
126 'type' => CRM_Utils_Type
::T_TEXT
,
127 'title' => ts('Submitted Form Values'),
128 'description' => ts('Submitted form values for this search'),
130 'where' => 'civicrm_saved_search.form_values',
132 'table_name' => 'civicrm_saved_search',
133 'entity' => 'SavedSearch',
134 'bao' => 'CRM_Contact_BAO_SavedSearch',
136 'serialize' => self
::SERIALIZE_PHP
,
140 'name' => 'mapping_id',
141 'type' => CRM_Utils_Type
::T_INT
,
142 'title' => ts('Mapping ID'),
143 'description' => ts('Foreign key to civicrm_mapping used for saved search-builder searches.'),
144 'where' => 'civicrm_saved_search.mapping_id',
145 'table_name' => 'civicrm_saved_search',
146 'entity' => 'SavedSearch',
147 'bao' => 'CRM_Contact_BAO_SavedSearch',
149 'FKClassName' => 'CRM_Core_DAO_Mapping',
152 'search_custom_id' => [
153 'name' => 'search_custom_id',
154 'type' => CRM_Utils_Type
::T_INT
,
155 'title' => ts('Option Value ID'),
156 'description' => ts('Foreign key to civicrm_option value table used for saved custom searches.'),
157 'where' => 'civicrm_saved_search.search_custom_id',
158 'table_name' => 'civicrm_saved_search',
159 'entity' => 'SavedSearch',
160 'bao' => 'CRM_Contact_BAO_SavedSearch',
165 'name' => 'api_entity',
166 'type' => CRM_Utils_Type
::T_STRING
,
167 'title' => ts('Entity Name'),
168 'description' => ts('Entity name for API based search'),
170 'size' => CRM_Utils_Type
::HUGE
,
171 'where' => 'civicrm_saved_search.api_entity',
172 'table_name' => 'civicrm_saved_search',
173 'entity' => 'SavedSearch',
174 'bao' => 'CRM_Contact_BAO_SavedSearch',
179 'name' => 'api_params',
180 'type' => CRM_Utils_Type
::T_TEXT
,
181 'title' => ts('API Parameters'),
182 'description' => ts('Parameters for API based search'),
183 'where' => 'civicrm_saved_search.api_params',
184 'table_name' => 'civicrm_saved_search',
185 'entity' => 'SavedSearch',
186 'bao' => 'CRM_Contact_BAO_SavedSearch',
188 'serialize' => self
::SERIALIZE_JSON
,
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;