5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Campaign/CampaignGroup.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:55b3974bbc1aa8405d11a5c396401fa9)
13 * Database access object for the CampaignGroup entity.
15 class CRM_Campaign_DAO_CampaignGroup
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '3.3';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_campaign_group';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = FALSE;
41 * Foreign key to the activity Campaign.
55 * Name of table where item being referenced is stored.
62 * Entity id of referenced table.
71 public function __construct() {
72 $this->__table
= 'civicrm_campaign_group';
73 parent
::__construct();
77 * Returns localized title of this entity.
80 * Whether to return the plural version of the title.
82 public static function getEntityTitle($plural = FALSE) {
83 return $plural ?
ts('Campaign Groups') : ts('Campaign Group');
87 * Returns foreign keys and entity references.
90 * [CRM_Core_Reference_Interface]
92 public static function getReferenceColumns() {
93 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
94 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
95 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'campaign_id', 'civicrm_campaign', 'id');
96 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Dynamic(self
::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
97 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
99 return Civi
::$statics[__CLASS__
]['links'];
103 * Returns all the column names of this table
107 public static function &fields() {
108 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
109 Civi
::$statics[__CLASS__
]['fields'] = [
112 'type' => CRM_Utils_Type
::T_INT
,
113 'title' => ts('Campaign Group ID'),
114 'description' => ts('Campaign Group id.'),
116 'where' => 'civicrm_campaign_group.id',
117 'table_name' => 'civicrm_campaign_group',
118 'entity' => 'CampaignGroup',
119 'bao' => 'CRM_Campaign_DAO_CampaignGroup',
124 'name' => 'campaign_id',
125 'type' => CRM_Utils_Type
::T_INT
,
126 'title' => ts('Campaign'),
127 'description' => ts('Foreign key to the activity Campaign.'),
129 'where' => 'civicrm_campaign_group.campaign_id',
130 'table_name' => 'civicrm_campaign_group',
131 'entity' => 'CampaignGroup',
132 'bao' => 'CRM_Campaign_DAO_CampaignGroup',
134 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
135 'pseudoconstant' => [
136 'table' => 'civicrm_campaign',
138 'labelColumn' => 'title',
143 'name' => 'group_type',
144 'type' => CRM_Utils_Type
::T_STRING
,
145 'title' => ts('Campaign Group Type'),
146 'description' => ts('Type of Group.'),
148 'size' => CRM_Utils_Type
::EIGHT
,
149 'where' => 'civicrm_campaign_group.group_type',
151 'table_name' => 'civicrm_campaign_group',
152 'entity' => 'CampaignGroup',
153 'bao' => 'CRM_Campaign_DAO_CampaignGroup',
158 'pseudoconstant' => [
159 'callback' => 'CRM_Core_SelectValues::getCampaignGroupTypes',
164 'name' => 'entity_table',
165 'type' => CRM_Utils_Type
::T_STRING
,
166 'title' => ts('Entity Table'),
167 'description' => ts('Name of table where item being referenced is stored.'),
169 'size' => CRM_Utils_Type
::BIG
,
170 'where' => 'civicrm_campaign_group.entity_table',
172 'table_name' => 'civicrm_campaign_group',
173 'entity' => 'CampaignGroup',
174 'bao' => 'CRM_Campaign_DAO_CampaignGroup',
179 'name' => 'entity_id',
180 'type' => CRM_Utils_Type
::T_INT
,
181 'title' => ts('Entity ID'),
182 'description' => ts('Entity id of referenced table.'),
183 'where' => 'civicrm_campaign_group.entity_id',
185 'table_name' => 'civicrm_campaign_group',
186 'entity' => 'CampaignGroup',
187 'bao' => 'CRM_Campaign_DAO_CampaignGroup',
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__
, 'campaign_group', $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__
, 'campaign_group', $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;