Преглед на файлове

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);
     }