Code Duplication    Length = 16-17 lines in 6 locations

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

@@ 956-971 (lines=16) @@
953
     *
954
     * @param Schema $schema
955
     */
956
    protected function addOrocrmMagentoOrderEmailsForeignKeys(Schema $schema)
957
    {
958
        $table = $schema->getTable('orocrm_magento_order_emails');
959
        $table->addForeignKeyConstraint(
960
            $schema->getTable('orocrm_magento_order'),
961
            ['order_id'],
962
            ['id'],
963
            ['onDelete' => 'CASCADE']
964
        );
965
        $table->addForeignKeyConstraint(
966
            $schema->getTable('oro_email'),
967
            ['email_id'],
968
            ['id'],
969
            ['onDelete' => 'CASCADE']
970
        );
971
    }
972
973
    /**
974
     * Add orocrm_magento_customer_group foreign keys.
@@ 1134-1150 (lines=17) @@
1131
     *
1132
     * @param Schema $schema
1133
     */
1134
    protected function addOrocrmMagentoCustAddrTypeForeignKeys(Schema $schema)
1135
    {
1136
        $table = $schema->getTable('orocrm_magento_cust_addr_type');
1137
        $table->addForeignKeyConstraint(
1138
            $schema->getTable('orocrm_magento_customer_addr'),
1139
            ['customer_address_id'],
1140
            ['id'],
1141
            ['onDelete' => 'CASCADE'],
1142
            'FK_308A31F187EABF7'
1143
        );
1144
        $table->addForeignKeyConstraint(
1145
            $schema->getTable('oro_address_type'),
1146
            ['type_name'],
1147
            ['name'],
1148
            []
1149
        );
1150
    }
1151
1152
    /**
1153
     * Add orocrm_magento_order_address foreign keys.
@@ 1191-1207 (lines=17) @@
1188
     *
1189
     * @param Schema $schema
1190
     */
1191
    protected function addOrocrmMagentoOrderAddrTypeForeignKeys(Schema $schema)
1192
    {
1193
        $table = $schema->getTable('orocrm_magento_order_addr_type');
1194
        $table->addForeignKeyConstraint(
1195
            $schema->getTable('orocrm_magento_order_address'),
1196
            ['order_address_id'],
1197
            ['id'],
1198
            ['onDelete' => 'CASCADE'],
1199
            'FK_E927A18F466D5220'
1200
        );
1201
        $table->addForeignKeyConstraint(
1202
            $schema->getTable('oro_address_type'),
1203
            ['type_name'],
1204
            ['name'],
1205
            []
1206
        );
1207
    }
1208
1209
    /**
1210
     * Add orocrm_magento_product foreign keys.
@@ 1230-1245 (lines=16) @@
1227
     *
1228
     * @param Schema $schema
1229
     */
1230
    protected function addOrocrmMagentoProdToWebsiteForeignKeys(Schema $schema)
1231
    {
1232
        $table = $schema->getTable('orocrm_magento_prod_to_website');
1233
        $table->addForeignKeyConstraint(
1234
            $schema->getTable('orocrm_magento_product'),
1235
            ['product_id'],
1236
            ['id'],
1237
            ['onDelete' => 'CASCADE']
1238
        );
1239
        $table->addForeignKeyConstraint(
1240
            $schema->getTable('orocrm_magento_website'),
1241
            ['website_id'],
1242
            ['id'],
1243
            ['onDelete' => 'CASCADE']
1244
        );
1245
    }
1246
1247
    /**
1248
     * Add orocrm_magento_website foreign keys.
@@ 1354-1369 (lines=16) @@
1351
     *
1352
     * @param Schema $schema
1353
     */
1354
    protected function addOrocrmMagentoCartEmailsForeignKeys(Schema $schema)
1355
    {
1356
        $table = $schema->getTable('orocrm_magento_cart_emails');
1357
        $table->addForeignKeyConstraint(
1358
            $schema->getTable('orocrm_magento_cart'),
1359
            ['cart_id'],
1360
            ['id'],
1361
            ['onDelete' => 'CASCADE']
1362
        );
1363
        $table->addForeignKeyConstraint(
1364
            $schema->getTable('oro_email'),
1365
            ['email_id'],
1366
            ['id'],
1367
            ['onDelete' => 'CASCADE']
1368
        );
1369
    }
1370
1371
    /**
1372
     * Add orocrm_magento_store foreign keys.
@@ 1376-1391 (lines=16) @@
1373
     *
1374
     * @param Schema $schema
1375
     */
1376
    protected function addOrocrmMagentoStoreForeignKeys(Schema $schema)
1377
    {
1378
        $table = $schema->getTable('orocrm_magento_store');
1379
        $table->addForeignKeyConstraint(
1380
            $schema->getTable('orocrm_magento_website'),
1381
            ['website_id'],
1382
            ['id'],
1383
            ['onDelete' => 'cascade']
1384
        );
1385
        $table->addForeignKeyConstraint(
1386
            $schema->getTable('oro_integration_channel'),
1387
            ['channel_id'],
1388
            ['id'],
1389
            ['onDelete' => 'SET NULL']
1390
        );
1391
    }
1392
1393
    /**
1394
     * Add orocrm_magento_order_items foreign keys.