Code Duplication    Length = 17-17 lines in 2 locations

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

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