1
0
mirror of synced 2025-01-18 22:41:43 +03:00

Improve phrasing on exception message instead of trying to fix callers

This commit is contained in:
Andreas Flack 2014-04-28 14:50:48 +02:00 committed by Marco Pivetta
parent b8ef3af982
commit 0ade3aa62a
2 changed files with 4 additions and 4 deletions

View File

@ -65,7 +65,7 @@ class ORMInvalidArgumentException extends \InvalidArgumentException
static public function entityWithoutIdentity($className, $entity)
{
return new self(
"The given entity of type '" . $className . "' (".self::objToStr($entity).") has no identity/no " .
"The given entity of type '" . $className . "' (".self::objToStr($entity).") has no identity/no " .
"id values set. It cannot be added to the identity map."
);
}
@ -154,7 +154,7 @@ class ORMInvalidArgumentException extends \InvalidArgumentException
*/
static public function detachedEntityCannot($entity, $operation)
{
return new self("A detached entity was found during " . $operation . " " . self::objToStr($entity));
return new self("Detached entity " . self::objToStr($entity) . " cannot be " . $operation);
}
/**

View File

@ -1655,7 +1655,7 @@ class UnitOfWork implements PropertyChangedListener
case self::STATE_DETACHED:
// Can actually not happen right now since we assume STATE_NEW.
throw ORMInvalidArgumentException::detachedEntityCannot($entity, "persist");
throw ORMInvalidArgumentException::detachedEntityCannot($entity, "persisted");
default:
throw new UnexpectedValueException("Unexpected entity state: $entityState." . self::objToStr($entity));
@ -1726,7 +1726,7 @@ class UnitOfWork implements PropertyChangedListener
break;
case self::STATE_DETACHED:
throw ORMInvalidArgumentException::detachedEntityCannot($entity, "remove");
throw ORMInvalidArgumentException::detachedEntityCannot($entity, "removed");
default:
throw new UnexpectedValueException("Unexpected entity state: $entityState." . self::objToStr($entity));
}