Code Duplication    Length = 17-17 lines in 2 locations

lib/Doctrine/DBAL/Platforms/MySqlPlatform.php 2 locations

@@ 724-740 (lines=17) @@
721
        $tableName = $diff->getName($this)->getQuotedName($this);
722
723
        // Dropping primary keys requires to unset autoincrement attribute on the particular column first.
724
        foreach ($index->getColumns() as $columnName) {
725
            if (! $diff->fromTable->hasColumn($columnName)) {
726
                continue;
727
            }
728
729
            $column = $diff->fromTable->getColumn($columnName);
730
731
            if ($column->getAutoincrement() === true) {
732
                $column->setAutoincrement(false);
733
734
                $sql[] = 'ALTER TABLE ' . $tableName . ' MODIFY ' .
735
                    $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
736
737
                // original autoincrement information might be needed later on by other parts of the table alteration
738
                $column->setAutoincrement(true);
739
            }
740
        }
741
742
        return $sql;
743
    }
@@ 758-774 (lines=17) @@
755
        foreach ($diff->changedIndexes as $changedIndex) {
756
            // Changed primary key
757
            if ($changedIndex->isPrimary() && $diff->fromTable instanceof Table) {
758
                foreach ($diff->fromTable->getPrimaryKeyColumns() as $columnName) {
759
                    $column = $diff->fromTable->getColumn($columnName);
760
761
                    // Check if an autoincrement column was dropped from the primary key.
762
                    if ($column->getAutoincrement() && ! in_array($columnName, $changedIndex->getColumns())) {
763
                        // The autoincrement attribute needs to be removed from the dropped column
764
                        // before we can drop and recreate the primary key.
765
                        $column->setAutoincrement(false);
766
767
                        $sql[] = 'ALTER TABLE ' . $table . ' MODIFY ' .
768
                            $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
769
770
                        // Restore the autoincrement attribute as it might be needed later on
771
                        // by other parts of the table alteration.
772
                        $column->setAutoincrement(true);
773
                    }
774
                }
775
            }
776
        }
777