Code Duplication    Length = 28-28 lines in 7 locations

src/OroCRM/Bundle/CallBundle/Migrations/Schema/OroCRMCallBundleInstaller.php 1 location

@@ 127-154 (lines=28) @@
124
     *
125
     * @param Schema $schema
126
     */
127
    protected function addOrocrmCallForeignKeys(Schema $schema)
128
    {
129
        $table = $schema->getTable('orocrm_call');
130
        $table->addForeignKeyConstraint(
131
            $schema->getTable('orocrm_call_direction'),
132
            ['call_direction_name'],
133
            ['name'],
134
            ['onDelete' => 'SET NULL', 'onUpdate' => null]
135
        );
136
        $table->addForeignKeyConstraint(
137
            $schema->getTable('orocrm_call_status'),
138
            ['call_status_name'],
139
            ['name'],
140
            ['onDelete' => 'SET NULL', 'onUpdate' => null]
141
        );
142
        $table->addForeignKeyConstraint(
143
            $schema->getTable('oro_organization'),
144
            ['organization_id'],
145
            ['id'],
146
            ['onDelete' => 'SET NULL', 'onUpdate' => null]
147
        );
148
        $table->addForeignKeyConstraint(
149
            $schema->getTable('oro_user'),
150
            ['owner_id'],
151
            ['id'],
152
            ['onDelete' => 'SET NULL', 'onUpdate' => null]
153
        );
154
    }
155
}
156

src/OroCRM/Bundle/CampaignBundle/Migrations/Schema/OroCRMCampaignBundleInstaller.php 1 location

@@ 264-291 (lines=28) @@
261
     *
262
     * @param Schema $schema
263
     */
264
    protected function addOrocrmEmailCampaignStatisticsForeignKeys(Schema $schema)
265
    {
266
        $table = $schema->getTable('orocrm_campaign_email_stats');
267
        $table->addForeignKeyConstraint(
268
            $schema->getTable('orocrm_campaign_email'),
269
            ['email_campaign_id'],
270
            ['id'],
271
            ['onUpdate' => null, 'onDelete' => 'CASCADE']
272
        );
273
        $table->addForeignKeyConstraint(
274
            $schema->getTable('orocrm_marketing_list_item'),
275
            ['marketing_list_item_id'],
276
            ['id'],
277
            ['onUpdate' => null, 'onDelete' => 'CASCADE']
278
        );
279
        $table->addForeignKeyConstraint(
280
            $schema->getTable('oro_user'),
281
            ['owner_id'],
282
            ['id'],
283
            ['onUpdate' => null, 'onDelete' => 'SET NULL']
284
        );
285
        $table->addForeignKeyConstraint(
286
            $schema->getTable('oro_organization'),
287
            ['organization_id'],
288
            ['id'],
289
            ['onUpdate' => null, 'onDelete' => 'SET NULL']
290
        );
291
    }
292
293
    /**
294
     * Add orocrm_campaign_te_summary foreign keys.

src/OroCRM/Bundle/CampaignBundle/Migrations/Schema/v1_3/OroCRMCampaignBundle.php 1 location

@@ 107-134 (lines=28) @@
104
     *
105
     * @param Schema $schema
106
     */
107
    protected function addOrocrmCampaignEmailForeignKeys(Schema $schema)
108
    {
109
        $table = $schema->getTable('orocrm_campaign_email');
110
        $table->addForeignKeyConstraint(
111
            $schema->getTable('orocrm_campaign'),
112
            ['campaign_id'],
113
            ['id'],
114
            ['onUpdate' => null, 'onDelete' => 'SET NULL']
115
        );
116
        $table->addForeignKeyConstraint(
117
            $schema->getTable('orocrm_cmpgn_transport_stngs'),
118
            ['transport_settings_id'],
119
            ['id'],
120
            ['onUpdate' => null, 'onDelete' => 'SET NULL']
121
        );
122
        $table->addForeignKeyConstraint(
123
            $schema->getTable('orocrm_marketing_list'),
124
            ['marketing_list_id'],
125
            ['id'],
126
            ['onUpdate' => null, 'onDelete' => 'SET NULL']
127
        );
128
        $table->addForeignKeyConstraint(
129
            $schema->getTable('oro_user'),
130
            ['owner_id'],
131
            ['id'],
132
            ['onUpdate' => null, 'onDelete' => 'SET NULL']
133
        );
134
    }
135
136
    /**
137
     * Add orocrm_campaign_email_stats foreign keys.

src/OroCRM/Bundle/CaseBundle/Migrations/Schema/v1_5/OroCRMCaseBundle.php 1 location

@@ 46-73 (lines=28) @@
43
     *
44
     * @param Schema $schema
45
     */
46
    public static function addOroEmailMailboxProcessSettingsForeignKeys(Schema $schema)
47
    {
48
        $table = $schema->getTable('oro_email_mailbox_process');
49
        $table->addForeignKeyConstraint(
50
            $schema->getTable('oro_user'),
51
            ['case_assign_to_id'],
52
            ['id'],
53
            ['onDelete' => 'SET NULL', 'onUpdate' => null]
54
        );
55
        $table->addForeignKeyConstraint(
56
            $schema->getTable('orocrm_case_status'),
57
            ['case_status_name'],
58
            ['name'],
59
            ['onDelete' => 'SET NULL', 'onUpdate' => null]
60
        );
61
        $table->addForeignKeyConstraint(
62
            $schema->getTable('oro_user'),
63
            ['case_owner_id'],
64
            ['id'],
65
            ['onDelete' => 'SET NULL', 'onUpdate' => null]
66
        );
67
        $table->addForeignKeyConstraint(
68
            $schema->getTable('orocrm_case_priority'),
69
            ['case_priority_name'],
70
            ['name'],
71
            ['onDelete' => 'SET NULL', 'onUpdate' => null]
72
        );
73
    }
74
}
75

src/OroCRM/Bundle/ChannelBundle/Migrations/Schema/v1_0/OroCRMChannelBundle.php 1 location

@@ 151-178 (lines=28) @@
148
     *
149
     * @param Schema $schema
150
     */
151
    protected function addOrocrmChannelCustIdentityForeignKeys(Schema $schema)
152
    {
153
        $table = $schema->getTable('orocrm_channel_cust_identity');
154
        $table->addForeignKeyConstraint(
155
            $schema->getTable('orocrm_channel'),
156
            ['data_channel_id'],
157
            ['id'],
158
            ['onDelete' => 'SET NULL', 'onUpdate' => null]
159
        );
160
        $table->addForeignKeyConstraint(
161
            $schema->getTable('orocrm_account'),
162
            ['account_id'],
163
            ['id'],
164
            ['onDelete' => 'SET NULL', 'onUpdate' => null]
165
        );
166
        $table->addForeignKeyConstraint(
167
            $schema->getTable('oro_user'),
168
            ['user_owner_id'],
169
            ['id'],
170
            ['onDelete' => 'SET NULL', 'onUpdate' => null]
171
        );
172
        $table->addForeignKeyConstraint(
173
            $schema->getTable('orocrm_contact'),
174
            ['contact_id'],
175
            ['id'],
176
            ['onDelete' => 'SET NULL', 'onUpdate' => null]
177
        );
178
    }
179
180
    /**
181
     * @param $schema

src/OroCRM/Bundle/MarketingListBundle/Migrations/Schema/OroCRMMarketingListBundleInstaller.php 1 location

@@ 142-169 (lines=28) @@
139
     *
140
     * @param Schema $schema
141
     */
142
    protected function addOrocrmMarketingListForeignKeys(Schema $schema)
143
    {
144
        $table = $schema->getTable('orocrm_marketing_list');
145
        $table->addForeignKeyConstraint(
146
            $schema->getTable('oro_organization'),
147
            ['organization_id'],
148
            ['id'],
149
            ['onUpdate' => null, 'onDelete' => 'SET NULL']
150
        );
151
        $table->addForeignKeyConstraint(
152
            $schema->getTable('orocrm_marketing_list_type'),
153
            ['type'],
154
            ['name'],
155
            ['onUpdate' => null, 'onDelete' => null]
156
        );
157
        $table->addForeignKeyConstraint(
158
            $schema->getTable('oro_segment'),
159
            ['segment_id'],
160
            ['id'],
161
            ['onUpdate' => null, 'onDelete' => 'SET NULL']
162
        );
163
        $table->addForeignKeyConstraint(
164
            $schema->getTable('oro_user'),
165
            ['owner_id'],
166
            ['id'],
167
            ['onUpdate' => null, 'onDelete' => 'SET NULL']
168
        );
169
    }
170
171
    /**
172
     * Add orocrm_ml_item_uns foreign keys.

src/OroCRM/Bundle/CaseBundle/Migrations/Schema/OroCRMCaseBundleInstaller.php 1 location

@@ 405-432 (lines=28) @@
402
     *
403
     * @param Schema $schema
404
     */
405
    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