Created
December 13, 2015 18:52
-
-
Save doctrinebot/6ef6a70fa32d52002d13 to your computer and use it in GitHub Desktop.
Attachments to Doctrine Jira Issue DBAL-53 - https://github.com/doctrine/dbal/issues/1736
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: library/Doctrine/ORM/Persisters/BasicEntityPersister.php | |
=================================================================== | |
--- library/Doctrine/ORM/Persisters/BasicEntityPersister.php (revision 635) | |
+++ library/Doctrine/ORM/Persisters/BasicEntityPersister.php (working copy) | |
@@ -1149,7 +1149,10 @@ | |
$owningAssoc = $this->_class->associationMappings[$assoc['mappedBy']]; | |
$sourceClass = $this->_em->getClassMetadata($assoc['sourceEntity']); | |
foreach ($owningAssoc['targetToSourceKeyColumns'] as $sourceKeyColumn => $targetKeyColumn) { | |
- $criteria[$targetKeyColumn] = $sourceClass->reflFields[$sourceClass->fieldNames[$sourceKeyColumn]]->getValue($sourceEntity); | |
+ $criteria[$targetKeyColumn] = $this->_conn->convertToDatabaseValue( | |
+ $sourceClass->reflFields[$sourceClass->fieldNames[$sourceKeyColumn]]->getValue($sourceEntity), | |
+ $sourceClass->getTypeOfColumn($sourceKeyColumn) | |
+ ); | |
} | |
$sql = $this->_getSelectEntitiesSQL($criteria, $assoc); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: library/Doctrine/ORM/Persisters/BasicEntityPersister.php | |
=================================================================== | |
--- library/Doctrine/ORM/Persisters/BasicEntityPersister.php (revision 640) | |
+++ library/Doctrine/ORM/Persisters/BasicEntityPersister.php (working copy) | |
@@ -580,7 +580,10 @@ | |
// TRICKY: since the association is specular source and target are flipped | |
foreach ($owningAssoc['targetToSourceKeyColumns'] as $sourceKeyColumn => $targetKeyColumn) { | |
if (isset($sourceClass->fieldNames[$sourceKeyColumn])) { | |
- $identifier[$targetKeyColumn] = $sourceClass->reflFields[$sourceClass->fieldNames[$sourceKeyColumn]]->getValue($sourceEntity); | |
+ $identifier[$targetKeyColumn] = $this->_conn->convertToDatabaseValue( | |
+ $sourceClass->reflFields[$sourceClass->fieldNames[$sourceKeyColumn]]->getValue($sourceEntity), | |
+ $sourceClass->getTypeOfColumn($sourceKeyColumn) | |
+ ); | |
} else { | |
throw MappingException::joinColumnMustPointToMappedField( | |
$sourceClass->name, $sourceKeyColumn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: library/Doctrine/ORM/Persisters/BasicEntityPersister.php | |
=================================================================== | |
--- library/Doctrine/ORM/Persisters/BasicEntityPersister.php (revision 641) | |
+++ library/Doctrine/ORM/Persisters/BasicEntityPersister.php (working copy) | |
@@ -386,6 +386,12 @@ | |
$this->deleteJoinTableRecords($identifier); | |
$id = array_combine($this->_class->getIdentifierColumnNames(), $identifier); | |
+ foreach ($id as $column => $value) { | |
+ $id[$column] = $this->_conn->convertToDatabaseValue( | |
+ $this->_class->reflFields[$this->_class->fieldNames[$column]]->getValue($entity), | |
+ $this->_class->getTypeOfColumn($column) | |
+ ); | |
+ } | |
$this->_conn->delete($this->_class->table['name'], $id); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment