Skip to content

Commit

Permalink
Small optimization.
Browse files Browse the repository at this point in the history
  • Loading branch information
guilhermeblanco committed Jan 13, 2015
1 parent 678f47f commit bc268da
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/Doctrine/ORM/Persisters/ManyToManyPersister.php
Original file line number Diff line number Diff line change
Expand Up @@ -383,10 +383,9 @@ protected function getDeleteSQLParameters(PersistentCollection $coll)
*/
protected function getDeleteRowSQL(PersistentCollection $coll)
{
$columns = array();
$mapping = $coll->getMapping();
$class = $this->em->getClassMetadata(get_class($coll->getOwner()));
$tableName = $this->quoteStrategy->getJoinTableName($mapping, $class, $this->platform);
$mapping = $coll->getMapping();
$class = $this->em->getClassMetadata($mapping['sourceEntity']);
$columns = array();

foreach ($mapping['joinTable']['joinColumns'] as $joinColumn) {
$columns[] = $this->quoteStrategy->getJoinColumnName($joinColumn, $class, $this->platform);
Expand All @@ -396,8 +395,8 @@ protected function getDeleteRowSQL(PersistentCollection $coll)
$columns[] = $this->quoteStrategy->getJoinColumnName($joinColumn, $class, $this->platform);
}

return 'DELETE FROM ' . $tableName
. ' WHERE ' . implode(' = ? AND ', $columns) . ' = ?';
return 'DELETE FROM ' . $this->quoteStrategy->getJoinTableName($mapping, $class, $this->platform)
. ' WHERE ' . implode(' = ? AND ', $columns) . ' = ?';
}

/**
Expand Down

0 comments on commit bc268da

Please sign in to comment.