1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace OroCRM\Bundle\CaseBundle\Migrations\Schema; |
4
|
|
|
|
5
|
|
|
use Doctrine\DBAL\Schema\Schema; |
6
|
|
|
|
7
|
|
|
use Oro\Bundle\ActivityListBundle\Migration\Extension\ActivityListExtension; |
8
|
|
|
use Oro\Bundle\ActivityListBundle\Migration\Extension\ActivityListExtensionAwareInterface; |
9
|
|
|
use Oro\Bundle\AttachmentBundle\Migration\Extension\AttachmentExtension; |
10
|
|
|
use Oro\Bundle\AttachmentBundle\Migration\Extension\AttachmentExtensionAwareInterface; |
11
|
|
|
use Oro\Bundle\MigrationBundle\Migration\Installation; |
12
|
|
|
use Oro\Bundle\MigrationBundle\Migration\QueryBag; |
13
|
|
|
use Oro\Bundle\ActivityBundle\Migration\Extension\ActivityExtension; |
14
|
|
|
use Oro\Bundle\ActivityBundle\Migration\Extension\ActivityExtensionAwareInterface; |
15
|
|
|
use Oro\Bundle\NoteBundle\Migration\Extension\NoteExtension; |
16
|
|
|
use Oro\Bundle\NoteBundle\Migration\Extension\NoteExtensionAwareInterface; |
17
|
|
|
|
18
|
|
|
use OroCRM\Bundle\CaseBundle\Migrations\Schema\v1_7\InheritanceActivityTargets; |
19
|
|
|
use OroCRM\Bundle\CaseBundle\Migrations\Schema\v1_8\CreateActivityAssociation; |
20
|
|
|
|
21
|
|
|
class OroCRMCaseBundleInstaller implements |
22
|
|
|
Installation, |
23
|
|
|
AttachmentExtensionAwareInterface, |
24
|
|
|
ActivityExtensionAwareInterface, |
25
|
|
|
ActivityListExtensionAwareInterface, |
26
|
|
|
NoteExtensionAwareInterface |
27
|
|
|
{ |
28
|
|
|
/** @var AttachmentExtension */ |
29
|
|
|
protected $attachmentExtension; |
30
|
|
|
|
31
|
|
|
/** @var ActivityExtension */ |
32
|
|
|
protected $activityExtension; |
33
|
|
|
|
34
|
|
|
/** @var NoteExtension */ |
35
|
|
|
protected $noteExtension; |
36
|
|
|
|
37
|
|
|
/** @var ActivityListExtension */ |
38
|
|
|
protected $activityListExtension; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* {@inheritdoc} |
42
|
|
|
*/ |
43
|
|
|
public function getMigrationVersion() |
44
|
|
|
{ |
45
|
|
|
return 'v1_8'; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* {@inheritdoc} |
50
|
|
|
*/ |
51
|
|
|
public function setActivityListExtension(ActivityListExtension $activityListExtension) |
52
|
|
|
{ |
53
|
|
|
$this->activityListExtension = $activityListExtension; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* {@inheritdoc} |
58
|
|
|
*/ |
59
|
|
|
public function setAttachmentExtension(AttachmentExtension $attachmentExtension) |
60
|
|
|
{ |
61
|
|
|
$this->attachmentExtension = $attachmentExtension; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* {@inheritdoc} |
66
|
|
|
*/ |
67
|
|
|
public function setActivityExtension(ActivityExtension $activityExtension) |
68
|
|
|
{ |
69
|
|
|
$this->activityExtension = $activityExtension; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* {@inheritdoc} |
74
|
|
|
*/ |
75
|
|
|
public function setNoteExtension(NoteExtension $noteExtension) |
76
|
|
|
{ |
77
|
|
|
$this->noteExtension = $noteExtension; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* {@inheritdoc} |
83
|
|
|
*/ |
84
|
|
|
public function up(Schema $schema, QueryBag $queries) |
85
|
|
|
{ |
86
|
|
|
/** Tables generation **/ |
87
|
|
|
$this->createOrocrmCaseTable($schema); |
88
|
|
|
$this->createOrocrmCaseSourceTable($schema); |
89
|
|
|
$this->createOrocrmCaseSourceTranslationTable($schema); |
90
|
|
|
$this->createOrocrmCaseStatusTable($schema); |
91
|
|
|
$this->createOrocrmCaseStatusTranslationTable($schema); |
92
|
|
|
$this->createOrocrmCasePriorityTable($schema); |
93
|
|
|
$this->createOrocrmCasePriorityTranslationTable($schema); |
94
|
|
|
$this->createOrocrmCaseCommentTranslationTable($schema); |
95
|
|
|
|
96
|
|
|
/** Tables update */ |
97
|
|
|
$this->addOroEmailMailboxProcessSettingsColumns($schema); |
98
|
|
|
|
99
|
|
|
/** Foreign keys generation **/ |
100
|
|
|
$this->addOrocrmCaseForeignKeys($schema); |
101
|
|
|
$this->addOrocrmCaseCommentForeignKeys($schema); |
102
|
|
|
$this->addOroEmailMailboxProcessSettingsForeignKeys($schema); |
103
|
|
|
|
104
|
|
|
$this->addActivityAssociations($schema, $this->activityExtension); |
105
|
|
|
CreateActivityAssociation::addNoteAssociations($schema, $this->noteExtension); |
106
|
|
|
InheritanceActivityTargets::addInheritanceTargets($schema, $this->activityListExtension); |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* Create orocrm_case table |
111
|
|
|
* |
112
|
|
|
* @param Schema $schema |
113
|
|
|
*/ |
114
|
|
|
protected function createOrocrmCaseTable(Schema $schema) |
115
|
|
|
{ |
116
|
|
|
$table = $schema->createTable('orocrm_case'); |
117
|
|
|
$table->addColumn('id', 'integer', ['autoincrement' => true]); |
118
|
|
|
$table->addColumn('subject', 'string', ['length' => 255]); |
119
|
|
|
$table->addColumn('description', 'text', ['notnull' => false]); |
120
|
|
|
$table->addColumn('resolution', 'text', ['notnull' => false]); |
121
|
|
|
$table->addColumn('related_contact_id', 'integer', ['notnull' => false]); |
122
|
|
|
$table->addColumn('related_account_id', 'integer', ['notnull' => false]); |
123
|
|
|
$table->addColumn('assigned_to_id', 'integer', ['notnull' => false]); |
124
|
|
|
$table->addColumn('owner_id', 'integer', ['notnull' => false]); |
125
|
|
|
$table->addColumn('organization_id', 'integer', ['notnull' => false]); |
126
|
|
|
$table->addColumn('source_name', 'string', ['notnull' => false, 'length' => 16]); |
127
|
|
|
$table->addColumn('status_name', 'string', ['notnull' => false, 'length' => 16]); |
128
|
|
|
$table->addColumn('priority_name', 'string', ['notnull' => false, 'length' => 16]); |
129
|
|
|
$table->addColumn('createdAt', 'datetime', []); |
130
|
|
|
$table->addColumn('updatedAt', 'datetime', ['notnull' => false]); |
131
|
|
|
$table->addColumn('reportedAt', 'datetime', []); |
132
|
|
|
$table->addColumn('closedAt', 'datetime', ['notnull' => false]); |
133
|
|
|
$table->setPrimaryKey(['id']); |
134
|
|
|
$table->addIndex(['owner_id'], 'IDX_AB3BAC1E7E3C61F9', []); |
135
|
|
|
$table->addIndex(['organization_id'], 'IDX_AB3BAC1E32C8A3DE', []); |
136
|
|
|
$table->addIndex(['assigned_to_id'], 'IDX_AB3BAC1EF4BD7827', []); |
137
|
|
|
$table->addIndex(['related_contact_id'], 'IDX_AB3BAC1E6D6C2DFA', []); |
138
|
|
|
$table->addIndex(['related_account_id'], 'IDX_AB3BAC1E11A6570A', []); |
139
|
|
|
$table->addIndex(['source_name'], 'IDX_AB3BAC1E5FA9FB05', []); |
140
|
|
|
$table->addIndex(['priority_name'], 'IDX_AB3BAC1E965BD3DF', []); |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* Create orocrm_case_source table |
145
|
|
|
* |
146
|
|
|
* @param Schema $schema |
147
|
|
|
*/ |
148
|
|
View Code Duplication |
protected function createOrocrmCaseSourceTable(Schema $schema) |
|
|
|
|
149
|
|
|
{ |
150
|
|
|
$table = $schema->createTable('orocrm_case_source'); |
151
|
|
|
$table->addColumn('name', 'string', ['length' => 16]); |
152
|
|
|
$table->addColumn('label', 'string', ['length' => 255]); |
153
|
|
|
$table->setPrimaryKey(['name']); |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* Create orocrm_case_source_trans table |
158
|
|
|
* |
159
|
|
|
* @param Schema $schema |
160
|
|
|
*/ |
161
|
|
View Code Duplication |
public static function createOrocrmCaseSourceTranslationTable(Schema $schema) |
|
|
|
|
162
|
|
|
{ |
163
|
|
|
$table = $schema->createTable('orocrm_case_source_trans'); |
164
|
|
|
$table->addColumn('id', 'integer', ['autoincrement' => true]); |
165
|
|
|
$table->addColumn('foreign_key', 'string', ['length' => 16]); |
166
|
|
|
$table->addColumn('content', 'string', ['length' => 255]); |
167
|
|
|
$table->addColumn('locale', 'string', ['length' => 8]); |
168
|
|
|
$table->addColumn('object_class', 'string', ['length' => 255]); |
169
|
|
|
$table->addColumn('field', 'string', ['length' => 32]); |
170
|
|
|
$table->setPrimaryKey(['id']); |
171
|
|
|
$table->addIndex( |
172
|
|
|
['locale', 'object_class', 'field', 'foreign_key'], |
173
|
|
|
'case_source_translation_idx', |
174
|
|
|
[] |
175
|
|
|
); |
176
|
|
|
} |
177
|
|
|
|
178
|
|
|
/** |
179
|
|
|
* Create orocrm_case_status table |
180
|
|
|
* |
181
|
|
|
* @param Schema $schema |
182
|
|
|
*/ |
183
|
|
View Code Duplication |
protected function createOrocrmCaseStatusTable(Schema $schema) |
|
|
|
|
184
|
|
|
{ |
185
|
|
|
$table = $schema->createTable('orocrm_case_status'); |
186
|
|
|
$table->addColumn('name', 'string', ['length' => 16]); |
187
|
|
|
$table->addColumn('`order`', 'integer'); |
188
|
|
|
$table->addColumn('label', 'string', ['length' => 255]); |
189
|
|
|
$table->setPrimaryKey(['name']); |
190
|
|
|
} |
191
|
|
|
|
192
|
|
|
/** |
193
|
|
|
* Create orocrm_case_status_trans table |
194
|
|
|
* |
195
|
|
|
* @param Schema $schema |
196
|
|
|
*/ |
197
|
|
View Code Duplication |
public static function createOrocrmCaseStatusTranslationTable(Schema $schema) |
|
|
|
|
198
|
|
|
{ |
199
|
|
|
$table = $schema->createTable('orocrm_case_status_trans'); |
200
|
|
|
$table->addColumn('id', 'integer', ['autoincrement' => true]); |
201
|
|
|
$table->addColumn('foreign_key', 'string', ['length' => 16]); |
202
|
|
|
$table->addColumn('content', 'string', ['length' => 255]); |
203
|
|
|
$table->addColumn('locale', 'string', ['length' => 8]); |
204
|
|
|
$table->addColumn('object_class', 'string', ['length' => 255]); |
205
|
|
|
$table->addColumn('field', 'string', ['length' => 32]); |
206
|
|
|
$table->setPrimaryKey(['id']); |
207
|
|
|
$table->addIndex( |
208
|
|
|
['locale', 'object_class', 'field', 'foreign_key'], |
209
|
|
|
'case_status_translation_idx', |
210
|
|
|
[] |
211
|
|
|
); |
212
|
|
|
} |
213
|
|
|
|
214
|
|
|
/** |
215
|
|
|
* Create orocrm_case_priority table |
216
|
|
|
* |
217
|
|
|
* @param Schema $schema |
218
|
|
|
*/ |
219
|
|
View Code Duplication |
protected function createOrocrmCasePriorityTable(Schema $schema) |
|
|
|
|
220
|
|
|
{ |
221
|
|
|
$table = $schema->createTable('orocrm_case_priority'); |
222
|
|
|
$table->addColumn('name', 'string', ['length' => 16]); |
223
|
|
|
$table->addColumn('`order`', 'integer'); |
224
|
|
|
$table->addColumn('label', 'string', ['length' => 255]); |
225
|
|
|
$table->setPrimaryKey(['name']); |
226
|
|
|
} |
227
|
|
|
|
228
|
|
|
/** |
229
|
|
|
* Create orocrm_case_priority_trans table |
230
|
|
|
* |
231
|
|
|
* @param Schema $schema |
232
|
|
|
*/ |
233
|
|
View Code Duplication |
public static function createOrocrmCasePriorityTranslationTable(Schema $schema) |
|
|
|
|
234
|
|
|
{ |
235
|
|
|
$table = $schema->createTable('orocrm_case_priority_trans'); |
236
|
|
|
$table->addColumn('id', 'integer', ['autoincrement' => true]); |
237
|
|
|
$table->addColumn('foreign_key', 'string', ['length' => 16]); |
238
|
|
|
$table->addColumn('content', 'string', ['length' => 255]); |
239
|
|
|
$table->addColumn('locale', 'string', ['length' => 8]); |
240
|
|
|
$table->addColumn('object_class', 'string', ['length' => 255]); |
241
|
|
|
$table->addColumn('field', 'string', ['length' => 32]); |
242
|
|
|
$table->setPrimaryKey(['id']); |
243
|
|
|
$table->addIndex( |
244
|
|
|
['locale', 'object_class', 'field', 'foreign_key'], |
245
|
|
|
'case_priority_translation_idx', |
246
|
|
|
[] |
247
|
|
|
); |
248
|
|
|
} |
249
|
|
|
|
250
|
|
|
/** |
251
|
|
|
* Create orocrm_case_comment table |
252
|
|
|
* |
253
|
|
|
* @param Schema $schema |
254
|
|
|
*/ |
255
|
|
View Code Duplication |
public static function createOrocrmCaseCommentTranslationTable(Schema $schema) |
|
|
|
|
256
|
|
|
{ |
257
|
|
|
$table = $schema->createTable('orocrm_case_comment'); |
258
|
|
|
$table->addColumn('id', 'integer', ['autoincrement' => true]); |
259
|
|
|
$table->addColumn('case_id', 'integer', ['notnull' => false]); |
260
|
|
|
$table->addColumn('updated_by_id', 'integer', ['notnull' => false]); |
261
|
|
|
$table->addColumn('owner_id', 'integer', ['notnull' => false]); |
262
|
|
|
$table->addColumn('organization_id', 'integer', ['notnull' => false]); |
263
|
|
|
$table->addColumn('contact_id', 'integer', ['notnull' => false]); |
264
|
|
|
$table->addColumn('message', 'text', []); |
265
|
|
|
$table->addColumn('public', 'boolean', ['default' => '0']); |
266
|
|
|
$table->addColumn('createdAt', 'datetime', []); |
267
|
|
|
$table->addColumn('updatedAt', 'datetime', []); |
268
|
|
|
$table->setPrimaryKey(['id']); |
269
|
|
|
$table->addIndex(['case_id'], 'IDX_604C70FBCF10D4F5', []); |
270
|
|
|
$table->addIndex(['contact_id'], 'IDX_604C70FBE7A1254A', []); |
271
|
|
|
$table->addIndex(['updated_by_id'], 'FK_604C70FB896DBBDE', []); |
272
|
|
|
$table->addIndex(['owner_id'], 'IDX_604C70FB7E3C61F9', []); |
273
|
|
|
$table->addIndex(['organization_id'], 'IDX_604C70FB32C8A3DE', []); |
274
|
|
|
} |
275
|
|
|
|
276
|
|
|
/** |
277
|
|
|
* Add orocrm_case foreign keys. |
278
|
|
|
* |
279
|
|
|
* @param Schema $schema |
280
|
|
|
*/ |
281
|
|
|
protected function addOrocrmCaseForeignKeys(Schema $schema) |
282
|
|
|
{ |
283
|
|
|
$table = $schema->getTable('orocrm_case'); |
284
|
|
|
$table->addForeignKeyConstraint( |
285
|
|
|
$schema->getTable('orocrm_contact'), |
286
|
|
|
['related_contact_id'], |
287
|
|
|
['id'], |
288
|
|
|
['onDelete' => 'SET NULL', 'onUpdate' => null] |
289
|
|
|
); |
290
|
|
|
$table->addForeignKeyConstraint( |
291
|
|
|
$schema->getTable('orocrm_account'), |
292
|
|
|
['related_account_id'], |
293
|
|
|
['id'], |
294
|
|
|
['onDelete' => 'SET NULL', 'onUpdate' => null] |
295
|
|
|
); |
296
|
|
|
$table->addForeignKeyConstraint( |
297
|
|
|
$schema->getTable('orocrm_case_source'), |
298
|
|
|
['source_name'], |
299
|
|
|
['name'], |
300
|
|
|
['onDelete' => 'SET NULL', 'onUpdate' => null] |
301
|
|
|
); |
302
|
|
|
$table->addForeignKeyConstraint( |
303
|
|
|
$schema->getTable('orocrm_case_status'), |
304
|
|
|
['status_name'], |
305
|
|
|
['name'], |
306
|
|
|
['onDelete' => 'SET NULL', 'onUpdate' => null] |
307
|
|
|
); |
308
|
|
|
$table->addForeignKeyConstraint( |
309
|
|
|
$schema->getTable('orocrm_case_priority'), |
310
|
|
|
['priority_name'], |
311
|
|
|
['name'], |
312
|
|
|
['onDelete' => 'SET NULL', 'onUpdate' => null] |
313
|
|
|
); |
314
|
|
|
$table->addForeignKeyConstraint( |
315
|
|
|
$schema->getTable('oro_user'), |
316
|
|
|
['assigned_to_id'], |
317
|
|
|
['id'], |
318
|
|
|
['onDelete' => 'SET NULL', 'onUpdate' => null] |
319
|
|
|
); |
320
|
|
|
$table->addForeignKeyConstraint( |
321
|
|
|
$schema->getTable('oro_user'), |
322
|
|
|
['owner_id'], |
323
|
|
|
['id'], |
324
|
|
|
['onDelete' => 'SET NULL', 'onUpdate' => null] |
325
|
|
|
); |
326
|
|
|
$table->addForeignKeyConstraint( |
327
|
|
|
$schema->getTable('oro_organization'), |
328
|
|
|
['organization_id'], |
329
|
|
|
['id'], |
330
|
|
|
['onDelete' => 'SET NULL', 'onUpdate' => null] |
331
|
|
|
); |
332
|
|
|
} |
333
|
|
|
|
334
|
|
|
/** |
335
|
|
|
* Add orocrm_case_comment foreign keys. |
336
|
|
|
* |
337
|
|
|
* @param Schema $schema |
338
|
|
|
*/ |
339
|
|
|
protected function addOrocrmCaseCommentForeignKeys(Schema $schema) |
340
|
|
|
{ |
341
|
|
|
$table = $schema->getTable('orocrm_case_comment'); |
342
|
|
|
$table->addForeignKeyConstraint( |
343
|
|
|
$schema->getTable('orocrm_case'), |
344
|
|
|
['case_id'], |
345
|
|
|
['id'], |
346
|
|
|
['onDelete' => 'CASCADE', 'onUpdate' => null] |
347
|
|
|
); |
348
|
|
|
$table->addForeignKeyConstraint( |
349
|
|
|
$schema->getTable('oro_user'), |
350
|
|
|
['updated_by_id'], |
351
|
|
|
['id'], |
352
|
|
|
['onDelete' => 'SET NULL', 'onUpdate' => null] |
353
|
|
|
); |
354
|
|
|
$table->addForeignKeyConstraint( |
355
|
|
|
$schema->getTable('oro_user'), |
356
|
|
|
['owner_id'], |
357
|
|
|
['id'], |
358
|
|
|
['onDelete' => 'SET NULL', 'onUpdate' => null] |
359
|
|
|
); |
360
|
|
|
$table->addForeignKeyConstraint( |
361
|
|
|
$schema->getTable('orocrm_contact'), |
362
|
|
|
['contact_id'], |
363
|
|
|
['id'], |
364
|
|
|
['onDelete' => 'SET NULL', 'onUpdate' => null] |
365
|
|
|
); |
366
|
|
|
$table->addForeignKeyConstraint( |
367
|
|
|
$schema->getTable('oro_organization'), |
368
|
|
|
['organization_id'], |
369
|
|
|
['id'], |
370
|
|
|
['onDelete' => 'SET NULL', 'onUpdate' => null] |
371
|
|
|
); |
372
|
|
|
|
373
|
|
|
$this->attachmentExtension->addFileRelation( |
374
|
|
|
$schema, |
375
|
|
|
'orocrm_case_comment', |
376
|
|
|
'attachment' |
377
|
|
|
); |
378
|
|
|
} |
379
|
|
|
|
380
|
|
|
/** |
381
|
|
|
* Adds required columns to oro_email_mailbox_process table. |
382
|
|
|
* |
383
|
|
|
* @param Schema $schema |
384
|
|
|
*/ |
385
|
|
View Code Duplication |
public static function addOroEmailMailboxProcessSettingsColumns(Schema $schema) |
|
|
|
|
386
|
|
|
{ |
387
|
|
|
$table = $schema->getTable('oro_email_mailbox_process'); |
388
|
|
|
|
389
|
|
|
$table->addColumn('case_assign_to_id', 'integer', ['notnull' => false]); |
390
|
|
|
$table->addColumn('case_status_name', 'string', ['notnull' => false, 'length' => 16]); |
391
|
|
|
$table->addColumn('case_owner_id', 'integer', ['notnull' => false]); |
392
|
|
|
$table->addColumn('case_priority_name', 'string', ['notnull' => false, 'length' => 16]); |
393
|
|
|
|
394
|
|
|
$table->addIndex(['case_owner_id'], 'IDX_CE8602A3E9411B84', []); |
395
|
|
|
$table->addIndex(['case_assign_to_id'], 'IDX_CE8602A37CFDD645', []); |
396
|
|
|
$table->addIndex(['case_priority_name'], 'IDX_CE8602A3F1B25087', []); |
397
|
|
|
$table->addIndex(['case_status_name'], 'IDX_CE8602A3C168B4FB', []); |
398
|
|
|
} |
399
|
|
|
|
400
|
|
|
/** |
401
|
|
|
* Adds foreign keys to new columns in oro_email_mailbox_process table. |
402
|
|
|
* |
403
|
|
|
* @param Schema $schema |
404
|
|
|
*/ |
405
|
|
View Code Duplication |
public static function addOroEmailMailboxProcessSettingsForeignKeys(Schema $schema) |
|
|
|
|
406
|
|
|
{ |
407
|
|
|
$table = $schema->getTable('oro_email_mailbox_process'); |
408
|
|
|
$table->addForeignKeyConstraint( |
409
|
|
|
$schema->getTable('oro_user'), |
410
|
|
|
['case_assign_to_id'], |
411
|
|
|
['id'], |
412
|
|
|
['onDelete' => 'SET NULL', 'onUpdate' => null] |
413
|
|
|
); |
414
|
|
|
$table->addForeignKeyConstraint( |
415
|
|
|
$schema->getTable('orocrm_case_status'), |
416
|
|
|
['case_status_name'], |
417
|
|
|
['name'], |
418
|
|
|
['onDelete' => 'SET NULL', 'onUpdate' => null] |
419
|
|
|
); |
420
|
|
|
$table->addForeignKeyConstraint( |
421
|
|
|
$schema->getTable('oro_user'), |
422
|
|
|
['case_owner_id'], |
423
|
|
|
['id'], |
424
|
|
|
['onDelete' => 'SET NULL', 'onUpdate' => null] |
425
|
|
|
); |
426
|
|
|
$table->addForeignKeyConstraint( |
427
|
|
|
$schema->getTable('orocrm_case_priority'), |
428
|
|
|
['case_priority_name'], |
429
|
|
|
['name'], |
430
|
|
|
['onDelete' => 'SET NULL', 'onUpdate' => null] |
431
|
|
|
); |
432
|
|
|
} |
433
|
|
|
|
434
|
|
|
/** |
435
|
|
|
* Enables Email activity for Case entity |
436
|
|
|
* |
437
|
|
|
* @param Schema $schema |
438
|
|
|
* @param ActivityExtension $activityExtension |
439
|
|
|
*/ |
440
|
|
|
protected function addActivityAssociations(Schema $schema, ActivityExtension $activityExtension) |
441
|
|
|
{ |
442
|
|
|
$activityExtension->addActivityAssociation($schema, 'oro_email', 'orocrm_case'); |
443
|
|
|
CreateActivityAssociation::addActivityAssociations($schema, $activityExtension); |
444
|
|
|
} |
445
|
|
|
} |
446
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.