Completed
Push — ezp24853-enhance_rest_when_fai... ( 1cf498...fc8bde )
by
unknown
25:05
created

ContentFieldValidationException::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 4
dl 0
loc 6
rs 9.4285
1
<?php
2
3
/**
4
 * File containing the ContentFieldValidationException tests.
5
 *
6
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
7
 * @license For full copyright and license information view LICENSE file distributed with this source code.
8
 *
9
 * @version //autogentag//
10
 */
11
namespace eZ\Publish\Core\REST\Server\Exceptions;
12
13
use Exception;
14
15
/**
16
 * Exception thrown if one or more content fields did not validate.
17
 */
18
class ContentFieldValidationException extends BadRequestException
19
{
20
    /**
21
     * Contains an array of field ValidationError objects indexed with FieldDefinition id and language code.
22
     * @see eZ\Publish\Core\Base\Exceptions\ContentFieldValidationException
23
     *
24
     * @var \eZ\Publish\Core\FieldType\ValidationError[]
25
     */
26
    protected $errors;
27
28
    public function __construct(array $errors, $message, $code = 0, Exception $previous = null)
29
    {
30
        $this->errors = $errors;
31
32
        parent::__construct($message, $code, $previous);
33
    }
34
35
    /**
36
     * Returns an array of field validation error messages.
37
     *
38
     * @return \eZ\Publish\Core\FieldType\ValidationError[]
39
     */
40
    public function getFieldErrors()
41
    {
42
        return $this->errors;
43
    }
44
}
45