Explorar o código

Support for class-level validation

This allows for

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

and similar code without an enclosing ->with().
Thomas Luzat %!s(int64=12) %!d(string=hai) anos
pai
achega
d3308eebb9
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  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());
     }