From 190e63a6bb995f0f17c4a13cd32014ceef08a369 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Sun, 10 Jun 2012 23:59:07 +0300 Subject: [PATCH 1/2] Show the advice only when necessary. This is indeed a good advice, but people who already have implemented __toString() might get confused about it. --- lib/Doctrine/ORM/ORMInvalidArgumentException.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Doctrine/ORM/ORMInvalidArgumentException.php b/lib/Doctrine/ORM/ORMInvalidArgumentException.php index b90bf21bc..480f88b1f 100644 --- a/lib/Doctrine/ORM/ORMInvalidArgumentException.php +++ b/lib/Doctrine/ORM/ORMInvalidArgumentException.php @@ -61,9 +61,11 @@ class ORMInvalidArgumentException extends \InvalidArgumentException . " configured to cascade persist operations for entity: " . self::objToStr($entry) . "." . " To solve this issue: Either explicitly call EntityManager#persist()" . " on this unknown entity or configure cascade persist " - . " this association in the mapping for example @ManyToOne(..,cascade={\"persist\"}). " - . " If you cannot find out which entity causes the problem" - . " implement '" . $assoc['targetEntity'] . "#__toString()' to get a clue."); + . " this association in the mapping for example @ManyToOne(..,cascade={\"persist\"})." + . method_exists($entry, '__toString') ? + "": + " If you cannot find out which entity causes the problem" + ." implement '" . $assoc['targetEntity'] . "#__toString()' to get a clue."); } static public function detachedEntityFoundThroughRelationship(array $assoc, $entry) From 111bb52add924223ad51854c4b632037fc86305c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Mon, 11 Jun 2012 08:23:37 +0200 Subject: [PATCH 2/2] delimit ternary --- lib/Doctrine/ORM/ORMInvalidArgumentException.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Doctrine/ORM/ORMInvalidArgumentException.php b/lib/Doctrine/ORM/ORMInvalidArgumentException.php index 480f88b1f..dcb5b823d 100644 --- a/lib/Doctrine/ORM/ORMInvalidArgumentException.php +++ b/lib/Doctrine/ORM/ORMInvalidArgumentException.php @@ -62,10 +62,10 @@ class ORMInvalidArgumentException extends \InvalidArgumentException . " To solve this issue: Either explicitly call EntityManager#persist()" . " on this unknown entity or configure cascade persist " . " this association in the mapping for example @ManyToOne(..,cascade={\"persist\"})." - . method_exists($entry, '__toString') ? + . (method_exists($entry, '__toString') ? "": " If you cannot find out which entity causes the problem" - ." implement '" . $assoc['targetEntity'] . "#__toString()' to get a clue."); + ." implement '" . $assoc['targetEntity'] . "#__toString()' to get a clue.")); } static public function detachedEntityFoundThroughRelationship(array $assoc, $entry)