Code Duplication    Length = 59-60 lines in 2 locations

src/OroCRM/Bundle/MagentoBundle/Migrations/Schema/v1_0/OroCRMMagentoBundle.php 1 location

@@ 641-700 (lines=60) @@
638
     *
639
     * @param Schema $schema
640
     */
641
    public static function orocrmMagentoCartForeignKeys(Schema $schema)
642
    {
643
        /** Generate foreign keys for table orocrm_magento_cart **/
644
        $table = $schema->getTable('orocrm_magento_cart');
645
        $table->addForeignKeyConstraint(
646
            $schema->getTable('oro_integration_channel'),
647
            ['channel_id'],
648
            ['id'],
649
            ['onDelete' => 'SET NULL', 'onUpdate' => null]
650
        );
651
        $table->addForeignKeyConstraint(
652
            $schema->getTable('oro_workflow_item'),
653
            ['workflow_item_id'],
654
            ['id'],
655
            ['onDelete' => 'SET NULL', 'onUpdate' => null]
656
        );
657
        $table->addForeignKeyConstraint(
658
            $schema->getTable('orocrm_magento_cart_address'),
659
            ['shipping_address_id'],
660
            ['id'],
661
            ['onDelete' => 'SET NULL', 'onUpdate' => null]
662
        );
663
        $table->addForeignKeyConstraint(
664
            $schema->getTable('orocrm_magento_cart_status'),
665
            ['status_name'],
666
            ['name'],
667
            ['onDelete' => 'SET NULL', 'onUpdate' => null]
668
        );
669
        $table->addForeignKeyConstraint(
670
            $schema->getTable('oro_workflow_step'),
671
            ['workflow_step_id'],
672
            ['id'],
673
            ['onDelete' => 'SET NULL', 'onUpdate' => null]
674
        );
675
        $table->addForeignKeyConstraint(
676
            $schema->getTable('orocrm_magento_cart_address'),
677
            ['billing_address_id'],
678
            ['id'],
679
            ['onDelete' => 'SET NULL', 'onUpdate' => null]
680
        );
681
        $table->addForeignKeyConstraint(
682
            $schema->getTable('orocrm_magento_customer'),
683
            ['customer_id'],
684
            ['id'],
685
            ['onDelete' => 'CASCADE', 'onUpdate' => null]
686
        );
687
        $table->addForeignKeyConstraint(
688
            $schema->getTable('orocrm_sales_opportunity'),
689
            ['opportunity_id'],
690
            ['id'],
691
            ['onDelete' => 'SET NULL', 'onUpdate' => null]
692
        );
693
        $table->addForeignKeyConstraint(
694
            $schema->getTable('orocrm_magento_store'),
695
            ['store_id'],
696
            ['id'],
697
            ['onDelete' => 'SET NULL', 'onUpdate' => null]
698
        );
699
        /** End of generate foreign keys for table orocrm_magento_cart **/
700
    }
701
702
    /**
703
     * Generate foreign keys for table orocrm_magento_cart_address

src/OroCRM/Bundle/SalesBundle/Migrations/Schema/OroCRMSalesBundleInstaller.php 1 location

@@ 534-592 (lines=59) @@
531
     *
532
     * @param Schema $schema
533
     */
534
    protected function addOrocrmSalesLeadForeignKeys(Schema $schema)
535
    {
536
        $table = $schema->getTable('orocrm_sales_lead');
537
        $table->addForeignKeyConstraint(
538
            $schema->getTable('orocrm_campaign'),
539
            ['campaign_id'],
540
            ['id'],
541
            ['onUpdate' => null, 'onDelete' => 'SET NULL']
542
        );
543
        $table->addForeignKeyConstraint(
544
            $schema->getTable('oro_address'),
545
            ['address_id'],
546
            ['id'],
547
            ['onUpdate' => null, 'onDelete' => 'SET NULL']
548
        );
549
        $table->addForeignKeyConstraint(
550
            $schema->getTable('orocrm_contact'),
551
            ['contact_id'],
552
            ['id'],
553
            ['onUpdate' => null, 'onDelete' => 'SET NULL']
554
        );
555
        $table->addForeignKeyConstraint(
556
            $schema->getTable('oro_user'),
557
            ['user_owner_id'],
558
            ['id'],
559
            ['onUpdate' => null, 'onDelete' => 'SET NULL']
560
        );
561
        $table->addForeignKeyConstraint(
562
            $schema->getTable('orocrm_sales_b2bcustomer'),
563
            ['customer_id'],
564
            ['id'],
565
            ['onDelete' => 'SET NULL', 'onUpdate' => null]
566
        );
567
        $table->addForeignKeyConstraint(
568
            $schema->getTable('orocrm_channel'),
569
            ['data_channel_id'],
570
            ['id'],
571
            ['onDelete' => 'SET NULL', 'onUpdate' => null],
572
            'FK_73DB4633BDC09B73'
573
        );
574
        $table->addForeignKeyConstraint(
575
            $schema->getTable('orocrm_sales_lead_status'),
576
            ['status_name'],
577
            ['name'],
578
            ['onUpdate' => null, 'onDelete' => null]
579
        );
580
        $table->addForeignKeyConstraint(
581
            $schema->getTable('oro_workflow_item'),
582
            ['workflow_item_id'],
583
            ['id'],
584
            ['onUpdate' => null, 'onDelete' => 'SET NULL']
585
        );
586
        $table->addForeignKeyConstraint(
587
            $schema->getTable('oro_workflow_step'),
588
            ['workflow_step_id'],
589
            ['id'],
590
            ['onUpdate' => null, 'onDelete' => 'SET NULL']
591
        );
592
    }
593
594
    /**
595
     * Add orocrm_sales_b2bcustomer foreign keys.