From ac98f15cfa15614aae18cd32533e913efc26963b Mon Sep 17 00:00:00 2001 From: Kirill chEbba Chebunin Date: Sun, 19 Aug 2012 22:58:40 +0400 Subject: [PATCH] Fix ORMInvalidArgumentException factory methods with return instead of throw --- lib/Doctrine/ORM/ORMInvalidArgumentException.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/Doctrine/ORM/ORMInvalidArgumentException.php b/lib/Doctrine/ORM/ORMInvalidArgumentException.php index dcb5b823d..d88917340 100644 --- a/lib/Doctrine/ORM/ORMInvalidArgumentException.php +++ b/lib/Doctrine/ORM/ORMInvalidArgumentException.php @@ -43,7 +43,7 @@ class ORMInvalidArgumentException extends \InvalidArgumentException static public function entityWithoutIdentity($className, $entity) { - throw new self( + return new self( "The given entity of type '" . $className . "' (".self::objToStr($entity).") has no identity/no " . "id values set. It cannot be added to the identity map." ); @@ -70,30 +70,30 @@ class ORMInvalidArgumentException extends \InvalidArgumentException static public function detachedEntityFoundThroughRelationship(array $assoc, $entry) { - throw new self("A detached entity of type " . $assoc['targetEntity'] . " (" . self::objToStr($entry) . ") " + return new self("A detached entity of type " . $assoc['targetEntity'] . " (" . self::objToStr($entry) . ") " . " was found through the relationship '" . $assoc['sourceEntity'] . "#" . $assoc['fieldName'] . "' " . "during cascading a persist operation."); } static public function entityNotManaged($entity) { - throw new self("Entity " . self::objToStr($entity) . " is not managed. An entity is managed if its fetched " . + return new self("Entity " . self::objToStr($entity) . " is not managed. An entity is managed if its fetched " . "from the database or registered as new through EntityManager#persist"); } static public function entityHasNoIdentity($entity, $operation) { - throw new self("Entity has no identity, therefore " . $operation ." cannot be performed. " . self::objToStr($entity)); + return new self("Entity has no identity, therefore " . $operation ." cannot be performed. " . self::objToStr($entity)); } static public function entityIsRemoved($entity, $operation) { - throw new self("Entity is removed, therefore " . $operation ." cannot be performed. " . self::objToStr($entity)); + return new self("Entity is removed, therefore " . $operation ." cannot be performed. " . self::objToStr($entity)); } static public function detachedEntityCannot($entity, $operation) { - throw new self("A detached entity was found during " . $operation . " " . self::objToStr($entity)); + return new self("A detached entity was found during " . $operation . " " . self::objToStr($entity)); } public static function invalidObject($context, $given, $parameterIndex = 1)