Skip to content

Commit

Permalink
EZP-31954: fix fatal error when no error target defined (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
ITernovtsii authored Oct 6, 2020
1 parent fece789 commit 67ad193
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/lib/Validator/Constraints/FieldValueValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
use eZ\Publish\Core\FieldType\ValidationError;
use eZ\Publish\SPI\FieldType\Value;
use EzSystems\EzPlatformContentForms\Data\Content\FieldData;
use Symfony\Component\Validator\Util\PropertyPath;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Util\PropertyPath;

/**
* Base class for field value validators.
Expand Down Expand Up @@ -89,6 +89,10 @@ protected function getFieldTypeIdentifier(ValueObject $value): string

protected function generatePropertyPath($errorIndex, $errorTarget): string
{
return PropertyPath::append('value', $errorTarget);
$basePath = 'value';

return $errorTarget === null
? $basePath
: PropertyPath::append($basePath, $errorTarget);
}
}

0 comments on commit 67ad193

Please sign in to comment.