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:978c5e6110b6905764ed276943711ac4)
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';
18 const COMPONENT
= 'CiviCampaign';
21 * Static instance to hold the table name.
25 public static $_tableName = 'civicrm_campaign_group';
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
32 public static $_log = FALSE;
42 * Foreign key to the activity Campaign.
56 * Name of table where item being referenced is stored.
63 * Entity id of referenced table.
72 public function __construct() {
73 $this->__table
= 'civicrm_campaign_group';
74 parent
::__construct();
78 * Returns localized title of this entity.
81 * Whether to return the plural version of the title.
83 public static function getEntityTitle($plural = FALSE) {
84 return $plural ?
ts('Campaign Groups') : ts('Campaign Group');
88 * Returns foreign keys and entity references.
91 * [CRM_Core_Reference_Interface]
93 public static function getReferenceColumns() {
94 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
95 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
96 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'campaign_id', 'civicrm_campaign', 'id');
97 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Dynamic(self
::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
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('Campaign Group ID'),
115 'description' => ts('Campaign Group id.'),
117 'where' => 'civicrm_campaign_group.id',
118 'table_name' => 'civicrm_campaign_group',
119 'entity' => 'CampaignGroup',
120 'bao' => 'CRM_Campaign_DAO_CampaignGroup',
129 'name' => 'campaign_id',
130 'type' => CRM_Utils_Type
::T_INT
,
131 'title' => ts('Campaign ID'),
132 'description' => ts('Foreign key to the activity Campaign.'),
134 'where' => 'civicrm_campaign_group.campaign_id',
135 'table_name' => 'civicrm_campaign_group',
136 'entity' => 'CampaignGroup',
137 'bao' => 'CRM_Campaign_DAO_CampaignGroup',
139 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
141 'type' => 'EntityRef',
142 'label' => ts("Campaign"),
144 'pseudoconstant' => [
145 'table' => 'civicrm_campaign',
147 'labelColumn' => 'title',
148 'prefetch' => 'FALSE',
153 'name' => 'group_type',
154 'type' => CRM_Utils_Type
::T_STRING
,
155 'title' => ts('Campaign Group Type'),
156 'description' => ts('Type of Group.'),
158 'size' => CRM_Utils_Type
::EIGHT
,
159 'where' => 'civicrm_campaign_group.group_type',
161 'table_name' => 'civicrm_campaign_group',
162 'entity' => 'CampaignGroup',
163 'bao' => 'CRM_Campaign_DAO_CampaignGroup',
168 'pseudoconstant' => [
169 'callback' => 'CRM_Core_SelectValues::getCampaignGroupTypes',
174 'name' => 'entity_table',
175 'type' => CRM_Utils_Type
::T_STRING
,
176 'title' => ts('Entity Table'),
177 'description' => ts('Name of table where item being referenced is stored.'),
179 'size' => CRM_Utils_Type
::BIG
,
180 'where' => 'civicrm_campaign_group.entity_table',
182 'table_name' => 'civicrm_campaign_group',
183 'entity' => 'CampaignGroup',
184 'bao' => 'CRM_Campaign_DAO_CampaignGroup',
189 'name' => 'entity_id',
190 'type' => CRM_Utils_Type
::T_INT
,
191 'title' => ts('Entity ID'),
192 'description' => ts('Entity id of referenced table.'),
193 'where' => 'civicrm_campaign_group.entity_id',
195 'table_name' => 'civicrm_campaign_group',
196 'entity' => 'CampaignGroup',
197 'bao' => 'CRM_Campaign_DAO_CampaignGroup',
202 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
204 return Civi
::$statics[__CLASS__
]['fields'];
208 * Return a mapping from field-name to the corresponding key (as used in fields()).
211 * Array(string $name => string $uniqueName).
213 public static function &fieldKeys() {
214 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
215 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
217 return Civi
::$statics[__CLASS__
]['fieldKeys'];
221 * Returns the names of this table
225 public static function getTableName() {
226 return self
::$_tableName;
230 * Returns if this table needs to be logged
234 public function getLog() {
239 * Returns the list of fields that can be imported
241 * @param bool $prefix
245 public static function &import($prefix = FALSE) {
246 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'campaign_group', $prefix, []);
251 * Returns the list of fields that can be exported
253 * @param bool $prefix
257 public static function &export($prefix = FALSE) {
258 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'campaign_group', $prefix, []);
263 * Returns the list of indices
265 * @param bool $localize
269 public static function indices($localize = TRUE) {
271 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;