Code Duplication    Length = 17-17 lines in 2 locations

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

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