Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixed this issue where the _getInsertColumnList() method was return dupl... #390

Closed
wants to merge 1 commit into from

4 participants

@Easen

...icated columns if the columns are quotes and the JoinColumns were not

Marc Easen Fixed this issue where the _getInsertColumnList() method was return d…
…uplicated columns if the columns are quotes and the JoinColumns were not
4637e5b
@travisbot

This pull request fails (merged 4637e5b into cc46135).

@beberlei
Owner

This looks like a fix for the symptom, not the root cause.

@FabioBatSilva

:-1: doesn't looks like a good way to fix.

@Easen, why do you need to quoted columns and unquoted join column ?
For sure duplicated columns is a problem, but your use case does not make sense for me..

@Easen

The reason for quoted columns and not quoted join columns is because that approach doesn't work when you come to update the schema of the DB. In this case when Doctrine queries MySQL for the current foreign keys, and the columns that are returned are not quoted. So when the diff is created Doctrine tries to remove these columns and recreates them, but quoted. I can appreciate that this is in fact the bug which I should be reporting.

Because of this undesired side effect I chose to quote columns and not join columns, but then another issue arose Doctrine comes to create an insert/update statement the list of columns that are produces are duplicated, the columns are quoted and appended are the join columns unquoted, for example.

INSERT INTO foo (id, barId, barId);

Just a little of background info:

The reason for these quotes it that I design my DB in MySQL Workbench and then export this into Doctrine entities. So I need a one size fits all solution for all database designs, so my approach is to quote all columns. At the end of the day Doctrine should have a problem with this.

@FabioBatSilva

Hi @Easen

Sorry, we couldn't accept this patch
The real problem here is the schema update that you describe

Could you create a new ticket given more details about the schema update problem ?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 5, 2012
  1. Fixed this issue where the _getInsertColumnList() method was return d…

    Marc Easen authored
    …uplicated columns if the columns are quotes and the JoinColumns were not
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 0 deletions.
  1. +9 −0 lib/Doctrine/ORM/Persisters/BasicEntityPersister.php
View
9 lib/Doctrine/ORM/Persisters/BasicEntityPersister.php
@@ -1248,6 +1248,15 @@ protected function _getInsertColumnList()
}
}
+ foreach($columns as &$column) {
+ if ($column[0] !== $this->_platform->getIdentifierQuoteCharacter()) {
+ $quotedColumn = $this->_platform->quoteSingleIdentifier($column);
+ if (in_array($quotedColumn, $columns)) {
+ $column = $quotedColumn;
+ }
+ }
+ }
+
return $columns;
}
Something went wrong with that request. Please try again.