1
0
mirror of synced 2025-01-31 20:41:44 +03:00

Small optimization.

This commit is contained in:
Guilherme Blanco 2015-01-13 03:30:07 +00:00
parent 678f47f494
commit bc268da8c2

View File

@ -383,10 +383,9 @@ class ManyToManyPersister extends AbstractCollectionPersister
*/ */
protected function getDeleteRowSQL(PersistentCollection $coll) protected function getDeleteRowSQL(PersistentCollection $coll)
{ {
$columns = array();
$mapping = $coll->getMapping(); $mapping = $coll->getMapping();
$class = $this->em->getClassMetadata(get_class($coll->getOwner())); $class = $this->em->getClassMetadata($mapping['sourceEntity']);
$tableName = $this->quoteStrategy->getJoinTableName($mapping, $class, $this->platform); $columns = array();
foreach ($mapping['joinTable']['joinColumns'] as $joinColumn) { foreach ($mapping['joinTable']['joinColumns'] as $joinColumn) {
$columns[] = $this->quoteStrategy->getJoinColumnName($joinColumn, $class, $this->platform); $columns[] = $this->quoteStrategy->getJoinColumnName($joinColumn, $class, $this->platform);
@ -396,7 +395,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
$columns[] = $this->quoteStrategy->getJoinColumnName($joinColumn, $class, $this->platform); $columns[] = $this->quoteStrategy->getJoinColumnName($joinColumn, $class, $this->platform);
} }
return 'DELETE FROM ' . $tableName return 'DELETE FROM ' . $this->quoteStrategy->getJoinTableName($mapping, $class, $this->platform)
. ' WHERE ' . implode(' = ? AND ', $columns) . ' = ?'; . ' WHERE ' . implode(' = ? AND ', $columns) . ' = ?';
} }