Code Duplication    Length = 16-17 lines in 8 locations

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

@@ 980-995 (lines=16) @@
977
     *
978
     * @param Schema $schema
979
     */
980
    protected function addOrocrmMagentoOrderCallsForeignKeys(Schema $schema)
981
    {
982
        $table = $schema->getTable('orocrm_magento_order_calls');
983
        $table->addForeignKeyConstraint(
984
            $schema->getTable('orocrm_magento_order'),
985
            ['order_id'],
986
            ['id'],
987
            ['onDelete' => 'CASCADE']
988
        );
989
        $table->addForeignKeyConstraint(
990
            $schema->getTable('orocrm_call'),
991
            ['call_id'],
992
            ['id'],
993
            ['onDelete' => 'CASCADE']
994
        );
995
    }
996
997
    /**
998
     * Add orocrm_magento_order_emails foreign keys.
@@ 1002-1017 (lines=16) @@
999
     *
1000
     * @param Schema $schema
1001
     */
1002
    protected function addOrocrmMagentoOrderEmailsForeignKeys(Schema $schema)
1003
    {
1004
        $table = $schema->getTable('orocrm_magento_order_emails');
1005
        $table->addForeignKeyConstraint(
1006
            $schema->getTable('orocrm_magento_order'),
1007
            ['order_id'],
1008
            ['id'],
1009
            ['onDelete' => 'CASCADE']
1010
        );
1011
        $table->addForeignKeyConstraint(
1012
            $schema->getTable('oro_email'),
1013
            ['email_id'],
1014
            ['id'],
1015
            ['onDelete' => 'CASCADE']
1016
        );
1017
    }
1018
1019
    /**
1020
     * Add orocrm_magento_customer_group foreign keys.
@@ 1180-1196 (lines=17) @@
1177
     *
1178
     * @param Schema $schema
1179
     */
1180
    protected function addOrocrmMagentoCustAddrTypeForeignKeys(Schema $schema)
1181
    {
1182
        $table = $schema->getTable('orocrm_magento_cust_addr_type');
1183
        $table->addForeignKeyConstraint(
1184
            $schema->getTable('orocrm_magento_customer_addr'),
1185
            ['customer_address_id'],
1186
            ['id'],
1187
            ['onDelete' => 'CASCADE'],
1188
            'FK_308A31F187EABF7'
1189
        );
1190
        $table->addForeignKeyConstraint(
1191
            $schema->getTable('oro_address_type'),
1192
            ['type_name'],
1193
            ['name'],
1194
            []
1195
        );
1196
    }
1197
1198
    /**
1199
     * Add orocrm_magento_order_address foreign keys.
@@ 1237-1253 (lines=17) @@
1234
     *
1235
     * @param Schema $schema
1236
     */
1237
    protected function addOrocrmMagentoOrderAddrTypeForeignKeys(Schema $schema)
1238
    {
1239
        $table = $schema->getTable('orocrm_magento_order_addr_type');
1240
        $table->addForeignKeyConstraint(
1241
            $schema->getTable('orocrm_magento_order_address'),
1242
            ['order_address_id'],
1243
            ['id'],
1244
            ['onDelete' => 'CASCADE'],
1245
            'FK_E927A18F466D5220'
1246
        );
1247
        $table->addForeignKeyConstraint(
1248
            $schema->getTable('oro_address_type'),
1249
            ['type_name'],
1250
            ['name'],
1251
            []
1252
        );
1253
    }
1254
1255
    /**
1256
     * Add orocrm_magento_product foreign keys.
@@ 1276-1291 (lines=16) @@
1273
     *
1274
     * @param Schema $schema
1275
     */
1276
    protected function addOrocrmMagentoProdToWebsiteForeignKeys(Schema $schema)
1277
    {
1278
        $table = $schema->getTable('orocrm_magento_prod_to_website');
1279
        $table->addForeignKeyConstraint(
1280
            $schema->getTable('orocrm_magento_product'),
1281
            ['product_id'],
1282
            ['id'],
1283
            ['onDelete' => 'CASCADE']
1284
        );
1285
        $table->addForeignKeyConstraint(
1286
            $schema->getTable('orocrm_magento_website'),
1287
            ['website_id'],
1288
            ['id'],
1289
            ['onDelete' => 'CASCADE']
1290
        );
1291
    }
1292
1293
    /**
1294
     * Add orocrm_magento_website foreign keys.
@@ 1398-1413 (lines=16) @@
1395
     *
1396
     * @param Schema $schema
1397
     */
1398
    protected function addOrocrmMagentoCartCallsForeignKeys(Schema $schema)
1399
    {
1400
        $table = $schema->getTable('orocrm_magento_cart_calls');
1401
        $table->addForeignKeyConstraint(
1402
            $schema->getTable('orocrm_magento_cart'),
1403
            ['cart_id'],
1404
            ['id'],
1405
            ['onDelete' => 'CASCADE']
1406
        );
1407
        $table->addForeignKeyConstraint(
1408
            $schema->getTable('orocrm_call'),
1409
            ['call_id'],
1410
            ['id'],
1411
            ['onDelete' => 'CASCADE']
1412
        );
1413
    }
1414
1415
    /**
1416
     * Add orocrm_magento_cart_emails foreign keys.
@@ 1420-1435 (lines=16) @@
1417
     *
1418
     * @param Schema $schema
1419
     */
1420
    protected function addOrocrmMagentoCartEmailsForeignKeys(Schema $schema)
1421
    {
1422
        $table = $schema->getTable('orocrm_magento_cart_emails');
1423
        $table->addForeignKeyConstraint(
1424
            $schema->getTable('orocrm_magento_cart'),
1425
            ['cart_id'],
1426
            ['id'],
1427
            ['onDelete' => 'CASCADE']
1428
        );
1429
        $table->addForeignKeyConstraint(
1430
            $schema->getTable('oro_email'),
1431
            ['email_id'],
1432
            ['id'],
1433
            ['onDelete' => 'CASCADE']
1434
        );
1435
    }
1436
1437
    /**
1438
     * Add orocrm_magento_store foreign keys.
@@ 1442-1457 (lines=16) @@
1439
     *
1440
     * @param Schema $schema
1441
     */
1442
    protected function addOrocrmMagentoStoreForeignKeys(Schema $schema)
1443
    {
1444
        $table = $schema->getTable('orocrm_magento_store');
1445
        $table->addForeignKeyConstraint(
1446
            $schema->getTable('orocrm_magento_website'),
1447
            ['website_id'],
1448
            ['id'],
1449
            ['onDelete' => 'cascade']
1450
        );
1451
        $table->addForeignKeyConstraint(
1452
            $schema->getTable('oro_integration_channel'),
1453
            ['channel_id'],
1454
            ['id'],
1455
            ['onDelete' => 'SET NULL']
1456
        );
1457
    }
1458
1459
    /**
1460
     * Add orocrm_magento_order_items foreign keys.