1
0
mirror of synced 2025-02-09 08:49:26 +03:00

#6017 throwing an ORMInvalidArgumentException when clearing with non-string data. Also removing duplicate null checking

This commit is contained in:
Marco Pivetta 2016-11-27 18:11:27 +01:00
parent c97799f151
commit 754e1f5d42

View File

@ -2360,13 +2360,11 @@ class UnitOfWork implements PropertyChangedListener
* @param string|null $entityName if given, only entities of this type will get detached.
*
* @return void
*
* @throws ORMInvalidArgumentException if an invalid entity name is given
*/
public function clear($entityName = null)
{
if ($entityName !== null && !is_string($entityName)) {
throw ORMException::invalidEntityName($entityName);
}
if ($entityName === null) {
$this->identityMap =
$this->entityIdentifiers =
@ -2384,6 +2382,10 @@ class UnitOfWork implements PropertyChangedListener
$this->visitedCollections =
$this->orphanRemovals = array();
} else {
if (! is_string($entityName)) {
throw ORMInvalidArgumentException::invalidEntityName($entityName);
}
$this->clearIdentityMapForEntityName($entityName);
$this->clearEntityInsertionsForEntityName($entityName);
}