#6017 throwing an ORMInvalidArgumentException
when clearing with non-string data. Also removing duplicate null checking
This commit is contained in:
parent
c97799f151
commit
754e1f5d42
@ -2360,13 +2360,11 @@ class UnitOfWork implements PropertyChangedListener
|
|||||||
* @param string|null $entityName if given, only entities of this type will get detached.
|
* @param string|null $entityName if given, only entities of this type will get detached.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
*
|
||||||
|
* @throws ORMInvalidArgumentException if an invalid entity name is given
|
||||||
*/
|
*/
|
||||||
public function clear($entityName = null)
|
public function clear($entityName = null)
|
||||||
{
|
{
|
||||||
if ($entityName !== null && !is_string($entityName)) {
|
|
||||||
throw ORMException::invalidEntityName($entityName);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($entityName === null) {
|
if ($entityName === null) {
|
||||||
$this->identityMap =
|
$this->identityMap =
|
||||||
$this->entityIdentifiers =
|
$this->entityIdentifiers =
|
||||||
@ -2384,6 +2382,10 @@ class UnitOfWork implements PropertyChangedListener
|
|||||||
$this->visitedCollections =
|
$this->visitedCollections =
|
||||||
$this->orphanRemovals = array();
|
$this->orphanRemovals = array();
|
||||||
} else {
|
} else {
|
||||||
|
if (! is_string($entityName)) {
|
||||||
|
throw ORMInvalidArgumentException::invalidEntityName($entityName);
|
||||||
|
}
|
||||||
|
|
||||||
$this->clearIdentityMapForEntityName($entityName);
|
$this->clearIdentityMapForEntityName($entityName);
|
||||||
$this->clearEntityInsertionsForEntityName($entityName);
|
$this->clearEntityInsertionsForEntityName($entityName);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user