Skip to content

Instantly share code, notes, and snippets.

@doctrinebot
Created December 13, 2015 18:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doctrinebot/a7aa165388fe76b70e1f to your computer and use it in GitHub Desktop.
Save doctrinebot/a7aa165388fe76b70e1f to your computer and use it in GitHub Desktop.
Attachments to Doctrine Jira Issue DDC-1850 - https://github.com/doctrine/doctrine2/issues/2511
# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: /home/pablo/www/site/backend/vendor/doctrine/lib/Doctrine/ORM/Persisters
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
Index: BasicEntityPersister.php
--- BasicEntityPersister.php Base (BASE)
+++ BasicEntityPersister.php Locally Modified (Based On LOCAL)
@@ -408,8 +408,20 @@
}
}
+ foreach ($keys as $value) {
+ if ($this->_class->fieldMappings[$this->_class->fieldNames[$value]]['quoted']) {
+ $id[] = $this->_platform->quoteIdentifier($value);
+ } else {
+ $id[] = $value;
+ }
+ }
+
if ( ! isset($mapping['isOnDeleteCascade'])) {
- $this->_conn->delete($mapping['joinTable']['name'], array_combine($keys, $identifier));
+ if ($mapping['joinTable']['quoted']) {
+ $this->_conn->delete($this->_class->getQuotedJoinTableName($mapping, $this->_platform), array_combine($id, $identifier));
+ } else {
+ $this->_conn->delete($mapping['joinTable']['name'], array_combine($id, $identifier));
+ }
if ($selfReferential) {
$this->_conn->delete($mapping['joinTable']['name'], array_combine($otherKeys, $identifier));
@@ -431,10 +443,18 @@
*/
public function delete($entity)
{
+
$identifier = $this->_em->getUnitOfWork()->getEntityIdentifier($entity);
$this->deleteJoinTableRecords($identifier);
- $id = array_combine($this->_class->getIdentifierColumnNames(), $identifier);
+// $id = array_combine($this->_class->getIdentifierColumnNames(), $identifier); // To Remove
+ foreach ($identifier as $columnName => $value) {
+ if ($this->_class->fieldMappings[$columnName]['quoted']) {
+ $id[$this->_platform->quoteIdentifier($this->_class->fieldMappings[$columnName]['columnName'])] = $value;
+ } else {
+ $id[$columnName] = $value;
+ }
+ }
$this->_conn->delete($this->_class->getQuotedTableName($this->_platform), $id);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment