Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

Core/FieldType/ValidationError.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\FieldType;
8
9 use eZ\Publish\SPI\FieldType\ValidationError as ValidationErrorInterface;
10 use eZ\Publish\API\Repository\Values\Translation\Message;
11 use eZ\Publish\API\Repository\Values\Translation\Plural;
12
16 class ValidationError implements ValidationErrorInterface
17 {
19 protected $singular;
20
22 protected $plural;
23
25 protected $values;
26
35 protected $target;
36
42 public function __construct($singular, $plural = null, array $values = [], $target = null)
43 {
44 $this->singular = $singular;
45 $this->plural = $plural;
46 $this->values = $values;
47 $this->target = $target;
48 }
49
55 public function getTranslatableMessage()
56 {
57 if (isset($this->plural)) {
58 return new Plural(
59 $this->singular,
60 $this->plural,
61 $this->values
62 );
63 } else {
64 return new Message(
65 $this->singular,
66 $this->values
67 );
68 }
69 }
70
71 public function setTarget($target)
72 {
73 $this->target = $target;
74 }
75
76 public function getTarget()
77 {
78 return $this->target;
79 }
80 }
eZ\Publish\API\Repository\Values\Translation\Message
Class for translatable messages, which only occur in singular form.
Definition: API/Repository/Values/Translation/Message.php:18
eZ\Publish\API\Repository\Values\Translation\Plural
Class for translatable messages, which may contain plural forms.
Definition: Plural.php:33
eZ\Publish\Core\FieldType\ValidationError
Class for validation errors.
Definition: Core/FieldType/ValidationError.php:17
eZ\Publish\Core\FieldType\ValidationError\$values
$values
Definition: Core/FieldType/ValidationError.php:25
eZ\Publish\Core\FieldType\ValidationError\setTarget
setTarget($target)
Sets the target element on which the error occurred.
Definition: Core/FieldType/ValidationError.php:71
eZ\Publish\Core\FieldType\ValidationError\__construct
__construct($singular, $plural=null, array $values=[], $target=null)
Definition: Core/FieldType/ValidationError.php:42
eZ\Publish\Core\FieldType\ValidationError\getTranslatableMessage
getTranslatableMessage()
Returns a translatable Message.
Definition: Core/FieldType/ValidationError.php:55
eZ\Publish\Core\FieldType\ValidationError\getTarget
getTarget()
Returns the target element on which the error occurred.
Definition: Core/FieldType/ValidationError.php:76
eZ\Publish\Core\FieldType\ValidationError\$target
$target
Definition: Core/FieldType/ValidationError.php:35
eZ\Publish\Core\FieldType\ValidationError\$singular
$singular
Definition: Core/FieldType/ValidationError.php:19
eZ\Publish\Core\FieldType\ValidationError\$plural
$plural
Definition: Core/FieldType/ValidationError.php:22
eZ\Publish\SPI\FieldType\ValidationError
Interface for validation errors.
Definition: SPI/FieldType/ValidationError.php:19
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.