Merge pull request #22631 from braders/calculateBaseScheduleDate-docblock
[civicrm-core.git] / CRM / Core / DAO / EntityTag.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Core/EntityTag.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:cabc3d8a72fecadc4d531226b1db4c1d)
10 */
11
12 /**
13 * Database access object for the EntityTag entity.
14 */
15 class CRM_Core_DAO_EntityTag extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '1.1';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_entity_tag';
25
26 /**
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
28 *
29 * @var bool
30 */
31 public static $_log = TRUE;
32
33 /**
34 * primary key
35 *
36 * @var int|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
39 */
40 public $id;
41
42 /**
43 * physical tablename for entity being joined to file, e.g. civicrm_contact
44 *
45 * @var string|null
46 * (SQL type: varchar(64))
47 * Note that values will be retrieved from the database as a string.
48 */
49 public $entity_table;
50
51 /**
52 * FK to entity table specified in entity_table column.
53 *
54 * @var int|string
55 * (SQL type: int unsigned)
56 * Note that values will be retrieved from the database as a string.
57 */
58 public $entity_id;
59
60 /**
61 * FK to civicrm_tag
62 *
63 * @var int|string
64 * (SQL type: int unsigned)
65 * Note that values will be retrieved from the database as a string.
66 */
67 public $tag_id;
68
69 /**
70 * Class constructor.
71 */
72 public function __construct() {
73 $this->__table = 'civicrm_entity_tag';
74 parent::__construct();
75 }
76
77 /**
78 * Returns localized title of this entity.
79 *
80 * @param bool $plural
81 * Whether to return the plural version of the title.
82 */
83 public static function getEntityTitle($plural = FALSE) {
84 return $plural ? ts('Entity Tags') : ts('Entity Tag');
85 }
86
87 /**
88 * Returns foreign keys and entity references.
89 *
90 * @return array
91 * [CRM_Core_Reference_Interface]
92 */
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(), 'tag_id', 'civicrm_tag', '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']);
99 }
100 return Civi::$statics[__CLASS__]['links'];
101 }
102
103 /**
104 * Returns all the column names of this table
105 *
106 * @return array
107 */
108 public static function &fields() {
109 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
110 Civi::$statics[__CLASS__]['fields'] = [
111 'id' => [
112 'name' => 'id',
113 'type' => CRM_Utils_Type::T_INT,
114 'title' => ts('Entity Tag ID'),
115 'description' => ts('primary key'),
116 'required' => TRUE,
117 'where' => 'civicrm_entity_tag.id',
118 'table_name' => 'civicrm_entity_tag',
119 'entity' => 'EntityTag',
120 'bao' => 'CRM_Core_BAO_EntityTag',
121 'localizable' => 0,
122 'html' => [
123 'type' => 'Number',
124 ],
125 'readonly' => TRUE,
126 'add' => '1.1',
127 ],
128 'entity_table' => [
129 'name' => 'entity_table',
130 'type' => CRM_Utils_Type::T_STRING,
131 'title' => ts('Entity Table'),
132 'description' => ts('physical tablename for entity being joined to file, e.g. civicrm_contact'),
133 'maxlength' => 64,
134 'size' => CRM_Utils_Type::BIG,
135 'where' => 'civicrm_entity_tag.entity_table',
136 'table_name' => 'civicrm_entity_tag',
137 'entity' => 'EntityTag',
138 'bao' => 'CRM_Core_BAO_EntityTag',
139 'localizable' => 0,
140 'pseudoconstant' => [
141 'optionGroupName' => 'tag_used_for',
142 'optionEditPath' => 'civicrm/admin/options/tag_used_for',
143 ],
144 'add' => '3.2',
145 ],
146 'entity_id' => [
147 'name' => 'entity_id',
148 'type' => CRM_Utils_Type::T_INT,
149 'title' => ts('Entity ID'),
150 'description' => ts('FK to entity table specified in entity_table column.'),
151 'required' => TRUE,
152 'where' => 'civicrm_entity_tag.entity_id',
153 'table_name' => 'civicrm_entity_tag',
154 'entity' => 'EntityTag',
155 'bao' => 'CRM_Core_BAO_EntityTag',
156 'localizable' => 0,
157 'add' => '3.2',
158 ],
159 'tag_id' => [
160 'name' => 'tag_id',
161 'type' => CRM_Utils_Type::T_INT,
162 'title' => ts('Tag ID'),
163 'description' => ts('FK to civicrm_tag'),
164 'required' => TRUE,
165 'where' => 'civicrm_entity_tag.tag_id',
166 'table_name' => 'civicrm_entity_tag',
167 'entity' => 'EntityTag',
168 'bao' => 'CRM_Core_BAO_EntityTag',
169 'localizable' => 0,
170 'FKClassName' => 'CRM_Core_DAO_Tag',
171 'html' => [
172 'type' => 'Select',
173 'label' => ts("Tag"),
174 ],
175 'pseudoconstant' => [
176 'table' => 'civicrm_tag',
177 'keyColumn' => 'id',
178 'labelColumn' => 'name',
179 'condition' => 'is_tagset != 1',
180 ],
181 'add' => '1.1',
182 ],
183 ];
184 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
185 }
186 return Civi::$statics[__CLASS__]['fields'];
187 }
188
189 /**
190 * Return a mapping from field-name to the corresponding key (as used in fields()).
191 *
192 * @return array
193 * Array(string $name => string $uniqueName).
194 */
195 public static function &fieldKeys() {
196 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
197 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
198 }
199 return Civi::$statics[__CLASS__]['fieldKeys'];
200 }
201
202 /**
203 * Returns the names of this table
204 *
205 * @return string
206 */
207 public static function getTableName() {
208 return self::$_tableName;
209 }
210
211 /**
212 * Returns if this table needs to be logged
213 *
214 * @return bool
215 */
216 public function getLog() {
217 return self::$_log;
218 }
219
220 /**
221 * Returns the list of fields that can be imported
222 *
223 * @param bool $prefix
224 *
225 * @return array
226 */
227 public static function &import($prefix = FALSE) {
228 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'entity_tag', $prefix, []);
229 return $r;
230 }
231
232 /**
233 * Returns the list of fields that can be exported
234 *
235 * @param bool $prefix
236 *
237 * @return array
238 */
239 public static function &export($prefix = FALSE) {
240 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'entity_tag', $prefix, []);
241 return $r;
242 }
243
244 /**
245 * Returns the list of indices
246 *
247 * @param bool $localize
248 *
249 * @return array
250 */
251 public static function indices($localize = TRUE) {
252 $indices = [
253 'UI_entity_id_entity_table_tag_id' => [
254 'name' => 'UI_entity_id_entity_table_tag_id',
255 'field' => [
256 0 => 'entity_id',
257 1 => 'entity_table',
258 2 => 'tag_id',
259 ],
260 'localizable' => FALSE,
261 'unique' => TRUE,
262 'sig' => 'civicrm_entity_tag::1::entity_id::entity_table::tag_id',
263 ],
264 ];
265 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
266 }
267
268 }