Code Duplication    Length = 16-17 lines in 8 locations

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

@@ 986-1001 (lines=16) @@
983
     *
984
     * @param Schema $schema
985
     */
986
    protected function addOrocrmMagentoOrderCallsForeignKeys(Schema $schema)
987
    {
988
        $table = $schema->getTable('orocrm_magento_order_calls');
989
        $table->addForeignKeyConstraint(
990
            $schema->getTable('orocrm_magento_order'),
991
            ['order_id'],
992
            ['id'],
993
            ['onDelete' => 'CASCADE']
994
        );
995
        $table->addForeignKeyConstraint(
996
            $schema->getTable('orocrm_call'),
997
            ['call_id'],
998
            ['id'],
999
            ['onDelete' => 'CASCADE']
1000
        );
1001
    }
1002
1003
    /**
1004
     * Add orocrm_magento_order_emails foreign keys.
@@ 1008-1023 (lines=16) @@
1005
     *
1006
     * @param Schema $schema
1007
     */
1008
    protected function addOrocrmMagentoOrderEmailsForeignKeys(Schema $schema)
1009
    {
1010
        $table = $schema->getTable('orocrm_magento_order_emails');
1011
        $table->addForeignKeyConstraint(
1012
            $schema->getTable('orocrm_magento_order'),
1013
            ['order_id'],
1014
            ['id'],
1015
            ['onDelete' => 'CASCADE']
1016
        );
1017
        $table->addForeignKeyConstraint(
1018
            $schema->getTable('oro_email'),
1019
            ['email_id'],
1020
            ['id'],
1021
            ['onDelete' => 'CASCADE']
1022
        );
1023
    }
1024
1025
    /**
1026
     * Add orocrm_magento_customer_group foreign keys.
@@ 1186-1202 (lines=17) @@
1183
     *
1184
     * @param Schema $schema
1185
     */
1186
    protected function addOrocrmMagentoCustAddrTypeForeignKeys(Schema $schema)
1187
    {
1188
        $table = $schema->getTable('orocrm_magento_cust_addr_type');
1189
        $table->addForeignKeyConstraint(
1190
            $schema->getTable('orocrm_magento_customer_addr'),
1191
            ['customer_address_id'],
1192
            ['id'],
1193
            ['onDelete' => 'CASCADE'],
1194
            'FK_308A31F187EABF7'
1195
        );
1196
        $table->addForeignKeyConstraint(
1197
            $schema->getTable('oro_address_type'),
1198
            ['type_name'],
1199
            ['name'],
1200
            []
1201
        );
1202
    }
1203
1204
    /**
1205
     * Add orocrm_magento_order_address foreign keys.
@@ 1243-1259 (lines=17) @@
1240
     *
1241
     * @param Schema $schema
1242
     */
1243
    protected function addOrocrmMagentoOrderAddrTypeForeignKeys(Schema $schema)
1244
    {
1245
        $table = $schema->getTable('orocrm_magento_order_addr_type');
1246
        $table->addForeignKeyConstraint(
1247
            $schema->getTable('orocrm_magento_order_address'),
1248
            ['order_address_id'],
1249
            ['id'],
1250
            ['onDelete' => 'CASCADE'],
1251
            'FK_E927A18F466D5220'
1252
        );
1253
        $table->addForeignKeyConstraint(
1254
            $schema->getTable('oro_address_type'),
1255
            ['type_name'],
1256
            ['name'],
1257
            []
1258
        );
1259
    }
1260
1261
    /**
1262
     * Add orocrm_magento_product foreign keys.
@@ 1282-1297 (lines=16) @@
1279
     *
1280
     * @param Schema $schema
1281
     */
1282
    protected function addOrocrmMagentoProdToWebsiteForeignKeys(Schema $schema)
1283
    {
1284
        $table = $schema->getTable('orocrm_magento_prod_to_website');
1285
        $table->addForeignKeyConstraint(
1286
            $schema->getTable('orocrm_magento_product'),
1287
            ['product_id'],
1288
            ['id'],
1289
            ['onDelete' => 'CASCADE']
1290
        );
1291
        $table->addForeignKeyConstraint(
1292
            $schema->getTable('orocrm_magento_website'),
1293
            ['website_id'],
1294
            ['id'],
1295
            ['onDelete' => 'CASCADE']
1296
        );
1297
    }
1298
1299
    /**
1300
     * Add orocrm_magento_website foreign keys.
@@ 1404-1419 (lines=16) @@
1401
     *
1402
     * @param Schema $schema
1403
     */
1404
    protected function addOrocrmMagentoCartCallsForeignKeys(Schema $schema)
1405
    {
1406
        $table = $schema->getTable('orocrm_magento_cart_calls');
1407
        $table->addForeignKeyConstraint(
1408
            $schema->getTable('orocrm_magento_cart'),
1409
            ['cart_id'],
1410
            ['id'],
1411
            ['onDelete' => 'CASCADE']
1412
        );
1413
        $table->addForeignKeyConstraint(
1414
            $schema->getTable('orocrm_call'),
1415
            ['call_id'],
1416
            ['id'],
1417
            ['onDelete' => 'CASCADE']
1418
        );
1419
    }
1420
1421
    /**
1422
     * Add orocrm_magento_cart_emails foreign keys.
@@ 1426-1441 (lines=16) @@
1423
     *
1424
     * @param Schema $schema
1425
     */
1426
    protected function addOrocrmMagentoCartEmailsForeignKeys(Schema $schema)
1427
    {
1428
        $table = $schema->getTable('orocrm_magento_cart_emails');
1429
        $table->addForeignKeyConstraint(
1430
            $schema->getTable('orocrm_magento_cart'),
1431
            ['cart_id'],
1432
            ['id'],
1433
            ['onDelete' => 'CASCADE']
1434
        );
1435
        $table->addForeignKeyConstraint(
1436
            $schema->getTable('oro_email'),
1437
            ['email_id'],
1438
            ['id'],
1439
            ['onDelete' => 'CASCADE']
1440
        );
1441
    }
1442
1443
    /**
1444
     * Add orocrm_magento_store foreign keys.
@@ 1448-1463 (lines=16) @@
1445
     *
1446
     * @param Schema $schema
1447
     */
1448
    protected function addOrocrmMagentoStoreForeignKeys(Schema $schema)
1449
    {
1450
        $table = $schema->getTable('orocrm_magento_store');
1451
        $table->addForeignKeyConstraint(
1452
            $schema->getTable('orocrm_magento_website'),
1453
            ['website_id'],
1454
            ['id'],
1455
            ['onDelete' => 'cascade']
1456
        );
1457
        $table->addForeignKeyConstraint(
1458
            $schema->getTable('oro_integration_channel'),
1459
            ['channel_id'],
1460
            ['id'],
1461
            ['onDelete' => 'SET NULL']
1462
        );
1463
    }
1464
1465
    /**
1466
     * Add orocrm_magento_order_items foreign keys.