/
ValidationError.php
42 lines (37 loc) · 1.31 KB
/
ValidationError.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
namespace Ibexa\Contracts\Core\FieldType;
use Ibexa\Contracts\Core\Repository\Translatable;
/**
* Interface for validation errors.
*
* Enforces to return a translatable message, since it will be necessary to
* present validation errors to the user. Thus we need plural form handling and
* replacements of placeholders and so on.
*/
interface ValidationError extends Translatable
{
/**
* Sets the target element on which the error occurred.
*
* E.g. Property of a Field value which didn't validate against validation.
* Can be a property path compatible with Symfony PropertyAccess component.
*
* Examples:
* - "[StringLengthValidator][minStringLength]" => Target is "minStringLength" key under "StringLengthValidator" key (fieldtype validator configuration)
* - "my_field_definition_identifier"
*
* @param string $target
*/
public function setTarget($target);
/**
* Returns the target element on which the error occurred.
*
* @return string
*/
public function getTarget();
}
class_alias(ValidationError::class, 'eZ\Publish\SPI\FieldType\ValidationError');