Code Duplication    Length = 16-17 lines in 6 locations

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

@@ 939-954 (lines=16) @@
936
     *
937
     * @param Schema $schema
938
     */
939
    protected function addOrocrmMagentoOrderEmailsForeignKeys(Schema $schema)
940
    {
941
        $table = $schema->getTable('orocrm_magento_order_emails');
942
        $table->addForeignKeyConstraint(
943
            $schema->getTable('orocrm_magento_order'),
944
            ['order_id'],
945
            ['id'],
946
            ['onDelete' => 'CASCADE']
947
        );
948
        $table->addForeignKeyConstraint(
949
            $schema->getTable('oro_email'),
950
            ['email_id'],
951
            ['id'],
952
            ['onDelete' => 'CASCADE']
953
        );
954
    }
955
956
    /**
957
     * Add orocrm_magento_customer_group foreign keys.
@@ 1117-1133 (lines=17) @@
1114
     *
1115
     * @param Schema $schema
1116
     */
1117
    protected function addOrocrmMagentoCustAddrTypeForeignKeys(Schema $schema)
1118
    {
1119
        $table = $schema->getTable('orocrm_magento_cust_addr_type');
1120
        $table->addForeignKeyConstraint(
1121
            $schema->getTable('orocrm_magento_customer_addr'),
1122
            ['customer_address_id'],
1123
            ['id'],
1124
            ['onDelete' => 'CASCADE'],
1125
            'FK_308A31F187EABF7'
1126
        );
1127
        $table->addForeignKeyConstraint(
1128
            $schema->getTable('oro_address_type'),
1129
            ['type_name'],
1130
            ['name'],
1131
            []
1132
        );
1133
    }
1134
1135
    /**
1136
     * Add orocrm_magento_order_address foreign keys.
@@ 1174-1190 (lines=17) @@
1171
     *
1172
     * @param Schema $schema
1173
     */
1174
    protected function addOrocrmMagentoOrderAddrTypeForeignKeys(Schema $schema)
1175
    {
1176
        $table = $schema->getTable('orocrm_magento_order_addr_type');
1177
        $table->addForeignKeyConstraint(
1178
            $schema->getTable('orocrm_magento_order_address'),
1179
            ['order_address_id'],
1180
            ['id'],
1181
            ['onDelete' => 'CASCADE'],
1182
            'FK_E927A18F466D5220'
1183
        );
1184
        $table->addForeignKeyConstraint(
1185
            $schema->getTable('oro_address_type'),
1186
            ['type_name'],
1187
            ['name'],
1188
            []
1189
        );
1190
    }
1191
1192
    /**
1193
     * Add orocrm_magento_product foreign keys.
@@ 1213-1228 (lines=16) @@
1210
     *
1211
     * @param Schema $schema
1212
     */
1213
    protected function addOrocrmMagentoProdToWebsiteForeignKeys(Schema $schema)
1214
    {
1215
        $table = $schema->getTable('orocrm_magento_prod_to_website');
1216
        $table->addForeignKeyConstraint(
1217
            $schema->getTable('orocrm_magento_product'),
1218
            ['product_id'],
1219
            ['id'],
1220
            ['onDelete' => 'CASCADE']
1221
        );
1222
        $table->addForeignKeyConstraint(
1223
            $schema->getTable('orocrm_magento_website'),
1224
            ['website_id'],
1225
            ['id'],
1226
            ['onDelete' => 'CASCADE']
1227
        );
1228
    }
1229
1230
    /**
1231
     * Add orocrm_magento_website foreign keys.
@@ 1325-1340 (lines=16) @@
1322
     *
1323
     * @param Schema $schema
1324
     */
1325
    protected function addOrocrmMagentoCartEmailsForeignKeys(Schema $schema)
1326
    {
1327
        $table = $schema->getTable('orocrm_magento_cart_emails');
1328
        $table->addForeignKeyConstraint(
1329
            $schema->getTable('orocrm_magento_cart'),
1330
            ['cart_id'],
1331
            ['id'],
1332
            ['onDelete' => 'CASCADE']
1333
        );
1334
        $table->addForeignKeyConstraint(
1335
            $schema->getTable('oro_email'),
1336
            ['email_id'],
1337
            ['id'],
1338
            ['onDelete' => 'CASCADE']
1339
        );
1340
    }
1341
1342
    /**
1343
     * Add orocrm_magento_store foreign keys.
@@ 1347-1362 (lines=16) @@
1344
     *
1345
     * @param Schema $schema
1346
     */
1347
    protected function addOrocrmMagentoStoreForeignKeys(Schema $schema)
1348
    {
1349
        $table = $schema->getTable('orocrm_magento_store');
1350
        $table->addForeignKeyConstraint(
1351
            $schema->getTable('orocrm_magento_website'),
1352
            ['website_id'],
1353
            ['id'],
1354
            ['onDelete' => 'cascade']
1355
        );
1356
        $table->addForeignKeyConstraint(
1357
            $schema->getTable('oro_integration_channel'),
1358
            ['channel_id'],
1359
            ['id'],
1360
            ['onDelete' => 'SET NULL']
1361
        );
1362
    }
1363
1364
    /**
1365
     * Add orocrm_magento_order_items foreign keys.