浏览代码

Support for class-level validation

This allows for

    $errorElement->addConstraint(new UniqueEntity(['fields' => 'email']));

and similar code without an enclosing ->with().
Thomas Luzat 12 年之前
父节点
当前提交
d3308eebb9
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      Validator/ErrorElement.php

+ 4 - 0
Validator/ErrorElement.php

@@ -147,6 +147,10 @@ class ErrorElement
      */
     protected function getValue()
     {
+        if ($this->current == '') {
+            return $this->subject;
+        }
+
         $propertyAccessor = PropertyAccess::getPropertyAccessor();
         return $propertyAccessor->getValue($this->subject, $this->getCurrentPropertyPath());
     }