소스 검색

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