Code Duplication    Length = 17-17 lines in 2 locations

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

@@ 712-728 (lines=17) @@
709
        $tableName = $diff->getName($this)->getQuotedName($this);
710
711
        // Dropping primary keys requires to unset autoincrement attribute on the particular column first.
712
        foreach ($index->getColumns() as $columnName) {
713
            if (! $diff->fromTable->hasColumn($columnName)) {
714
                continue;
715
            }
716
717
            $column = $diff->fromTable->getColumn($columnName);
718
719
            if ($column->getAutoincrement() === true) {
720
                $column->setAutoincrement(false);
721
722
                $sql[] = 'ALTER TABLE ' . $tableName . ' MODIFY ' .
723
                    $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
724
725
                // original autoincrement information might be needed later on by other parts of the table alteration
726
                $column->setAutoincrement(true);
727
            }
728
        }
729
730
        return $sql;
731
    }
@@ 746-762 (lines=17) @@
743
        foreach ($diff->changedIndexes as $changedIndex) {
744
            // Changed primary key
745
            if ($changedIndex->isPrimary() && $diff->fromTable instanceof Table) {
746
                foreach ($diff->fromTable->getPrimaryKeyColumns() as $columnName) {
747
                    $column = $diff->fromTable->getColumn($columnName);
748
749
                    // Check if an autoincrement column was dropped from the primary key.
750
                    if ($column->getAutoincrement() && ! in_array($columnName, $changedIndex->getColumns())) {
751
                        // The autoincrement attribute needs to be removed from the dropped column
752
                        // before we can drop and recreate the primary key.
753
                        $column->setAutoincrement(false);
754
755
                        $sql[] = 'ALTER TABLE ' . $table . ' MODIFY ' .
756
                            $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
757
758
                        // Restore the autoincrement attribute as it might be needed later on
759
                        // by other parts of the table alteration.
760
                        $column->setAutoincrement(true);
761
                    }
762
                }
763
            }
764
        }
765