code refactoring on OneToManyPersister
This commit is contained in:
parent
2b1aaebe18
commit
9a041c8fdb
@ -44,9 +44,11 @@ class OneToManyPersister extends AbstractCollectionPersister
|
|||||||
{
|
{
|
||||||
$mapping = $coll->getMapping();
|
$mapping = $coll->getMapping();
|
||||||
$class = $this->em->getClassMetadata($mapping['targetEntity']);
|
$class = $this->em->getClassMetadata($mapping['targetEntity']);
|
||||||
|
$tableName = $this->quoteStrategy->getTableName($class, $this->platform);
|
||||||
|
$idColumns = $class->getIdentifierColumnNames();
|
||||||
|
|
||||||
return 'DELETE FROM ' . $this->quoteStrategy->getTableName($class, $this->platform)
|
return 'DELETE FROM ' . $tableName
|
||||||
. ' WHERE ' . implode('= ? AND ', $class->getIdentifierColumnNames()) . ' = ?';
|
. ' WHERE ' . implode('= ? AND ', $idColumns) . ' = ?';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -119,7 +121,8 @@ class OneToManyPersister extends AbstractCollectionPersister
|
|||||||
$whereClauses = array();
|
$whereClauses = array();
|
||||||
$params = array();
|
$params = array();
|
||||||
|
|
||||||
foreach ($targetClass->associationMappings[$mapping['mappedBy']]['joinColumns'] as $joinColumn) {
|
$joinColumns = $targetClass->associationMappings[$mapping['mappedBy']]['joinColumns'];
|
||||||
|
foreach ($joinColumns as $joinColumn) {
|
||||||
$whereClauses[] = $joinColumn['name'] . ' = ?';
|
$whereClauses[] = $joinColumn['name'] . ' = ?';
|
||||||
|
|
||||||
$params[] = ($targetClass->containsForeignIdentifier)
|
$params[] = ($targetClass->containsForeignIdentifier)
|
||||||
|
Loading…
Reference in New Issue
Block a user