فهرست منبع

Merge pull request #12 from dbu/check-mapping

add check and helpful exception message on inconsistent type situation
Johannes 12 سال پیش
والد
کامیت
29d466596e
1فایلهای تغییر یافته به همراه3 افزوده شده و 0 حذف شده
  1. 3 0
      src/JMS/Serializer/NavigatorContext.php

+ 3 - 0
src/JMS/Serializer/NavigatorContext.php

@@ -58,6 +58,9 @@ class NavigatorContext
 
     public function isVisiting($object)
     {
+        if (! is_object($object)) {
+            throw new \LogicException('Expected object but got ' . gettype($object) . '. Do you have the wrong @Type mapping or could this be a Doctrine many-to-many relation?');
+        }
         return $this->visitingSet->contains($object);
     }