Code Duplication    Length = 16-17 lines in 6 locations

src/OroCRM/Bundle/MagentoBundle/Migrations/Schema/OroCRMMagentoBundleInstaller.php 6 locations

@@ 962-977 (lines=16) @@
959
     *
960
     * @param Schema $schema
961
     */
962
    protected function addOrocrmMagentoOrderEmailsForeignKeys(Schema $schema)
963
    {
964
        $table = $schema->getTable('orocrm_magento_order_emails');
965
        $table->addForeignKeyConstraint(
966
            $schema->getTable('orocrm_magento_order'),
967
            ['order_id'],
968
            ['id'],
969
            ['onDelete' => 'CASCADE']
970
        );
971
        $table->addForeignKeyConstraint(
972
            $schema->getTable('oro_email'),
973
            ['email_id'],
974
            ['id'],
975
            ['onDelete' => 'CASCADE']
976
        );
977
    }
978
979
    /**
980
     * Add orocrm_magento_customer_group foreign keys.
@@ 1140-1156 (lines=17) @@
1137
     *
1138
     * @param Schema $schema
1139
     */
1140
    protected function addOrocrmMagentoCustAddrTypeForeignKeys(Schema $schema)
1141
    {
1142
        $table = $schema->getTable('orocrm_magento_cust_addr_type');
1143
        $table->addForeignKeyConstraint(
1144
            $schema->getTable('orocrm_magento_customer_addr'),
1145
            ['customer_address_id'],
1146
            ['id'],
1147
            ['onDelete' => 'CASCADE'],
1148
            'FK_308A31F187EABF7'
1149
        );
1150
        $table->addForeignKeyConstraint(
1151
            $schema->getTable('oro_address_type'),
1152
            ['type_name'],
1153
            ['name'],
1154
            []
1155
        );
1156
    }
1157
1158
    /**
1159
     * Add orocrm_magento_order_address foreign keys.
@@ 1197-1213 (lines=17) @@
1194
     *
1195
     * @param Schema $schema
1196
     */
1197
    protected function addOrocrmMagentoOrderAddrTypeForeignKeys(Schema $schema)
1198
    {
1199
        $table = $schema->getTable('orocrm_magento_order_addr_type');
1200
        $table->addForeignKeyConstraint(
1201
            $schema->getTable('orocrm_magento_order_address'),
1202
            ['order_address_id'],
1203
            ['id'],
1204
            ['onDelete' => 'CASCADE'],
1205
            'FK_E927A18F466D5220'
1206
        );
1207
        $table->addForeignKeyConstraint(
1208
            $schema->getTable('oro_address_type'),
1209
            ['type_name'],
1210
            ['name'],
1211
            []
1212
        );
1213
    }
1214
1215
    /**
1216
     * Add orocrm_magento_product foreign keys.
@@ 1236-1251 (lines=16) @@
1233
     *
1234
     * @param Schema $schema
1235
     */
1236
    protected function addOrocrmMagentoProdToWebsiteForeignKeys(Schema $schema)
1237
    {
1238
        $table = $schema->getTable('orocrm_magento_prod_to_website');
1239
        $table->addForeignKeyConstraint(
1240
            $schema->getTable('orocrm_magento_product'),
1241
            ['product_id'],
1242
            ['id'],
1243
            ['onDelete' => 'CASCADE']
1244
        );
1245
        $table->addForeignKeyConstraint(
1246
            $schema->getTable('orocrm_magento_website'),
1247
            ['website_id'],
1248
            ['id'],
1249
            ['onDelete' => 'CASCADE']
1250
        );
1251
    }
1252
1253
    /**
1254
     * Add orocrm_magento_website foreign keys.
@@ 1360-1375 (lines=16) @@
1357
     *
1358
     * @param Schema $schema
1359
     */
1360
    protected function addOrocrmMagentoCartEmailsForeignKeys(Schema $schema)
1361
    {
1362
        $table = $schema->getTable('orocrm_magento_cart_emails');
1363
        $table->addForeignKeyConstraint(
1364
            $schema->getTable('orocrm_magento_cart'),
1365
            ['cart_id'],
1366
            ['id'],
1367
            ['onDelete' => 'CASCADE']
1368
        );
1369
        $table->addForeignKeyConstraint(
1370
            $schema->getTable('oro_email'),
1371
            ['email_id'],
1372
            ['id'],
1373
            ['onDelete' => 'CASCADE']
1374
        );
1375
    }
1376
1377
    /**
1378
     * Add orocrm_magento_store foreign keys.
@@ 1382-1397 (lines=16) @@
1379
     *
1380
     * @param Schema $schema
1381
     */
1382
    protected function addOrocrmMagentoStoreForeignKeys(Schema $schema)
1383
    {
1384
        $table = $schema->getTable('orocrm_magento_store');
1385
        $table->addForeignKeyConstraint(
1386
            $schema->getTable('orocrm_magento_website'),
1387
            ['website_id'],
1388
            ['id'],
1389
            ['onDelete' => 'cascade']
1390
        );
1391
        $table->addForeignKeyConstraint(
1392
            $schema->getTable('oro_integration_channel'),
1393
            ['channel_id'],
1394
            ['id'],
1395
            ['onDelete' => 'SET NULL']
1396
        );
1397
    }
1398
1399
    /**
1400
     * Add orocrm_magento_order_items foreign keys.