5 * @copyright CiviCRM LLC (c) 2004-2018
7 * Generated from xml/schema/CRM/Contact/Group.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:6db3c227371b68fadd9eb82c6e96ebfe)
13 * Database access object for the Group entity.
15 class CRM_Contact_DAO_Group
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 static $_tableName = 'civicrm_group';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
39 * Internal name of Group.
53 * Optional verbose description of the group.
60 * Module or process which created this group.
67 * FK to saved search table.
71 public $saved_search_id;
74 * Is this entry active?
81 * In what context(s) is this field visible.
88 * the sql where clause if a saved search acl
95 * the tables to be included in a select data
99 public $select_tables;
102 * the tables to be included in the count statement
106 public $where_tables;
116 * Date when we created the cache for a smart group
123 * Date and time when we need to refresh the cache next.
127 public $refresh_date;
130 * IDs of the parent(s)
137 * IDs of the child(ren)
144 * Is this group hidden?
156 * FK to contact table.
163 * FK to contact table.
172 public function __construct() {
173 $this->__table
= 'civicrm_group';
174 parent
::__construct();
178 * Returns foreign keys and entity references.
181 * [CRM_Core_Reference_Interface]
183 public static function getReferenceColumns() {
184 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
185 Civi
::$statics[__CLASS__
]['links'] = static ::createReferenceColumns(__CLASS__
);
186 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'saved_search_id', 'civicrm_saved_search', 'id');
187 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'created_id', 'civicrm_contact', 'id');
188 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'modified_id', 'civicrm_contact', 'id');
189 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
191 return Civi
::$statics[__CLASS__
]['links'];
195 * Returns all the column names of this table
199 public static function &fields() {
200 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
201 Civi
::$statics[__CLASS__
]['fields'] = [
204 'type' => CRM_Utils_Type
::T_INT
,
205 'title' => ts('Group ID'),
206 'description' => ts('Group ID'),
208 'table_name' => 'civicrm_group',
210 'bao' => 'CRM_Contact_BAO_Group',
215 'type' => CRM_Utils_Type
::T_STRING
,
216 'title' => ts('Group Name'),
217 'description' => ts('Internal name of Group.'),
219 'size' => CRM_Utils_Type
::BIG
,
220 'table_name' => 'civicrm_group',
222 'bao' => 'CRM_Contact_BAO_Group',
227 'type' => CRM_Utils_Type
::T_STRING
,
228 'title' => ts('Group Title'),
229 'description' => ts('Name of Group.'),
231 'size' => CRM_Utils_Type
::BIG
,
232 'table_name' => 'civicrm_group',
234 'bao' => 'CRM_Contact_BAO_Group',
238 'name' => 'description',
239 'type' => CRM_Utils_Type
::T_TEXT
,
240 'title' => ts('Group Description'),
241 'description' => ts('Optional verbose description of the group.'),
244 'table_name' => 'civicrm_group',
246 'bao' => 'CRM_Contact_BAO_Group',
249 'type' => 'TextArea',
254 'type' => CRM_Utils_Type
::T_STRING
,
255 'title' => ts('Group Source'),
256 'description' => ts('Module or process which created this group.'),
258 'size' => CRM_Utils_Type
::BIG
,
259 'table_name' => 'civicrm_group',
261 'bao' => 'CRM_Contact_BAO_Group',
264 'saved_search_id' => [
265 'name' => 'saved_search_id',
266 'type' => CRM_Utils_Type
::T_INT
,
267 'title' => ts('Saved Search ID'),
268 'description' => ts('FK to saved search table.'),
269 'table_name' => 'civicrm_group',
271 'bao' => 'CRM_Contact_BAO_Group',
273 'FKClassName' => 'CRM_Contact_DAO_SavedSearch',
276 'name' => 'is_active',
277 'type' => CRM_Utils_Type
::T_BOOLEAN
,
278 'title' => ts('Group Enabled'),
279 'description' => ts('Is this entry active?'),
280 'table_name' => 'civicrm_group',
282 'bao' => 'CRM_Contact_BAO_Group',
286 'name' => 'visibility',
287 'type' => CRM_Utils_Type
::T_STRING
,
288 'title' => ts('Group Visibility Setting'),
289 'description' => ts('In what context(s) is this field visible.'),
291 'size' => CRM_Utils_Type
::MEDIUM
,
292 'default' => 'User and User Admin Only',
293 'table_name' => 'civicrm_group',
295 'bao' => 'CRM_Contact_BAO_Group',
300 'pseudoconstant' => [
301 'callback' => 'CRM_Core_SelectValues::groupVisibility',
305 'name' => 'where_clause',
306 'type' => CRM_Utils_Type
::T_TEXT
,
307 'title' => ts('Group Where Clause'),
308 'description' => ts('the sql where clause if a saved search acl'),
309 'table_name' => 'civicrm_group',
311 'bao' => 'CRM_Contact_BAO_Group',
315 'name' => 'select_tables',
316 'type' => CRM_Utils_Type
::T_TEXT
,
317 'title' => ts('Tables For Select Clause'),
318 'description' => ts('the tables to be included in a select data'),
319 'table_name' => 'civicrm_group',
321 'bao' => 'CRM_Contact_BAO_Group',
323 'serialize' => self
::SERIALIZE_PHP
,
326 'name' => 'where_tables',
327 'type' => CRM_Utils_Type
::T_TEXT
,
328 'title' => ts('Tables For Where Clause'),
329 'description' => ts('the tables to be included in the count statement'),
330 'table_name' => 'civicrm_group',
332 'bao' => 'CRM_Contact_BAO_Group',
334 'serialize' => self
::SERIALIZE_PHP
,
337 'name' => 'group_type',
338 'type' => CRM_Utils_Type
::T_STRING
,
339 'title' => ts('Group Type'),
340 'description' => ts('FK to group type'),
342 'size' => CRM_Utils_Type
::HUGE
,
343 'table_name' => 'civicrm_group',
345 'bao' => 'CRM_Contact_BAO_Group',
347 'serialize' => self
::SERIALIZE_SEPARATOR_BOOKEND
,
348 'pseudoconstant' => [
349 'optionGroupName' => 'group_type',
350 'optionEditPath' => 'civicrm/admin/options/group_type',
354 'name' => 'cache_date',
355 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
356 'title' => ts('Group Cache Date'),
357 'description' => ts('Date when we created the cache for a smart group'),
359 'table_name' => 'civicrm_group',
361 'bao' => 'CRM_Contact_BAO_Group',
365 'name' => 'refresh_date',
366 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
367 'title' => ts('Next Group Refresh Time'),
368 'description' => ts('Date and time when we need to refresh the cache next.'),
370 'table_name' => 'civicrm_group',
372 'bao' => 'CRM_Contact_BAO_Group',
377 'type' => CRM_Utils_Type
::T_TEXT
,
378 'title' => ts('Group Parents'),
379 'description' => ts('IDs of the parent(s)'),
380 'table_name' => 'civicrm_group',
382 'bao' => 'CRM_Contact_BAO_Group',
384 'serialize' => self
::SERIALIZE_COMMA
,
385 'pseudoconstant' => [
386 'callback' => 'CRM_Core_PseudoConstant::allGroup',
390 'name' => 'children',
391 'type' => CRM_Utils_Type
::T_TEXT
,
392 'title' => ts('Group Children'),
393 'description' => ts('IDs of the child(ren)'),
394 'table_name' => 'civicrm_group',
396 'bao' => 'CRM_Contact_BAO_Group',
400 'name' => 'is_hidden',
401 'type' => CRM_Utils_Type
::T_BOOLEAN
,
402 'title' => ts('Group is Hidden'),
403 'description' => ts('Is this group hidden?'),
405 'table_name' => 'civicrm_group',
407 'bao' => 'CRM_Contact_BAO_Group',
411 'name' => 'is_reserved',
412 'type' => CRM_Utils_Type
::T_BOOLEAN
,
413 'title' => ts('Group is Reserved'),
415 'table_name' => 'civicrm_group',
417 'bao' => 'CRM_Contact_BAO_Group',
421 'name' => 'created_id',
422 'type' => CRM_Utils_Type
::T_INT
,
423 'title' => ts('Group Created By'),
424 'description' => ts('FK to contact table.'),
425 'table_name' => 'civicrm_group',
427 'bao' => 'CRM_Contact_BAO_Group',
429 'FKClassName' => 'CRM_Contact_DAO_Contact',
432 'name' => 'modified_id',
433 'type' => CRM_Utils_Type
::T_INT
,
434 'title' => ts('Group Modified By'),
435 'description' => ts('FK to contact table.'),
436 'table_name' => 'civicrm_group',
438 'bao' => 'CRM_Contact_BAO_Group',
440 'FKClassName' => 'CRM_Contact_DAO_Contact',
443 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
445 return Civi
::$statics[__CLASS__
]['fields'];
449 * Return a mapping from field-name to the corresponding key (as used in fields()).
452 * Array(string $name => string $uniqueName).
454 public static function &fieldKeys() {
455 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
456 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
458 return Civi
::$statics[__CLASS__
]['fieldKeys'];
462 * Returns the names of this table
466 public static function getTableName() {
467 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
471 * Returns if this table needs to be logged
475 public function getLog() {
480 * Returns the list of fields that can be imported
482 * @param bool $prefix
486 public static function &import($prefix = FALSE) {
487 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'group', $prefix, []);
492 * Returns the list of fields that can be exported
494 * @param bool $prefix
498 public static function &export($prefix = FALSE) {
499 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'group', $prefix, []);
504 * Returns the list of indices
506 * @param bool $localize
510 public static function indices($localize = TRUE) {
512 'index_group_type' => [
513 'name' => 'index_group_type',
517 'localizable' => FALSE,
518 'sig' => 'civicrm_group::0::group_type',
521 'name' => 'UI_title',
525 'localizable' => TRUE,
527 'sig' => 'civicrm_group::1::title',
534 'localizable' => FALSE,
536 'sig' => 'civicrm_group::1::name',
539 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;