5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Contact/GroupNesting.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:f93c2699304caa24bcb30d71891621ad)
13 * Database access object for the GroupNesting entity.
15 class CRM_Contact_DAO_GroupNesting
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '2.0';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_group_nesting';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = TRUE;
36 * @var int|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
43 * ID of the child group
46 * (SQL type: int unsigned)
47 * Note that values will be retrieved from the database as a string.
49 public $child_group_id;
52 * ID of the parent group
55 * (SQL type: int unsigned)
56 * Note that values will be retrieved from the database as a string.
58 public $parent_group_id;
63 public function __construct() {
64 $this->__table
= 'civicrm_group_nesting';
65 parent
::__construct();
69 * Returns localized title of this entity.
72 * Whether to return the plural version of the title.
74 public static function getEntityTitle($plural = FALSE) {
75 return $plural ?
ts('Group Nestings') : ts('Group Nesting');
79 * Returns foreign keys and entity references.
82 * [CRM_Core_Reference_Interface]
84 public static function getReferenceColumns() {
85 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
86 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
87 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'child_group_id', 'civicrm_group', 'id');
88 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'parent_group_id', 'civicrm_group', 'id');
89 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
91 return Civi
::$statics[__CLASS__
]['links'];
95 * Returns all the column names of this table
99 public static function &fields() {
100 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
101 Civi
::$statics[__CLASS__
]['fields'] = [
104 'type' => CRM_Utils_Type
::T_INT
,
105 'title' => ts('Group Nesting ID'),
106 'description' => ts('Relationship ID'),
108 'where' => 'civicrm_group_nesting.id',
109 'table_name' => 'civicrm_group_nesting',
110 'entity' => 'GroupNesting',
111 'bao' => 'CRM_Contact_BAO_GroupNesting',
119 'child_group_id' => [
120 'name' => 'child_group_id',
121 'type' => CRM_Utils_Type
::T_INT
,
122 'title' => ts('Child Group ID'),
123 'description' => ts('ID of the child group'),
125 'where' => 'civicrm_group_nesting.child_group_id',
126 'table_name' => 'civicrm_group_nesting',
127 'entity' => 'GroupNesting',
128 'bao' => 'CRM_Contact_BAO_GroupNesting',
130 'FKClassName' => 'CRM_Contact_DAO_Group',
132 'label' => ts("Child Group"),
136 'parent_group_id' => [
137 'name' => 'parent_group_id',
138 'type' => CRM_Utils_Type
::T_INT
,
139 'title' => ts('Parent Group ID'),
140 'description' => ts('ID of the parent group'),
142 'where' => 'civicrm_group_nesting.parent_group_id',
143 'table_name' => 'civicrm_group_nesting',
144 'entity' => 'GroupNesting',
145 'bao' => 'CRM_Contact_BAO_GroupNesting',
147 'FKClassName' => 'CRM_Contact_DAO_Group',
149 'label' => ts("Parent Group"),
154 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
156 return Civi
::$statics[__CLASS__
]['fields'];
160 * Return a mapping from field-name to the corresponding key (as used in fields()).
163 * Array(string $name => string $uniqueName).
165 public static function &fieldKeys() {
166 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
167 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
169 return Civi
::$statics[__CLASS__
]['fieldKeys'];
173 * Returns the names of this table
177 public static function getTableName() {
178 return self
::$_tableName;
182 * Returns if this table needs to be logged
186 public function getLog() {
191 * Returns the list of fields that can be imported
193 * @param bool $prefix
197 public static function &import($prefix = FALSE) {
198 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'group_nesting', $prefix, []);
203 * Returns the list of fields that can be exported
205 * @param bool $prefix
209 public static function &export($prefix = FALSE) {
210 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'group_nesting', $prefix, []);
215 * Returns the list of indices
217 * @param bool $localize
221 public static function indices($localize = TRUE) {
223 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;