Completed
Push — ezp26001-permissions_lookup_re... ( 2e76c0...5b8460 )
by
unknown
25:19
created

ContentFieldValidationException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 27
rs 10
wmc 2
lcom 0
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getFieldErrors() 0 4 1
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
namespace eZ\Publish\Core\REST\Server\Exceptions;
10
11
use eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException as APIContentFieldValidationException;
12
13
/**
14
 * Exception thrown if one or more content fields did not validate.
15
 */
16
class ContentFieldValidationException extends BadRequestException
17
{
18
    /**
19
     * Contains an array of field ValidationError objects indexed with FieldDefinition id and language code.
20
     * @see eZ\Publish\Core\Base\Exceptions\ContentFieldValidationException
21
     *
22
     * @var \eZ\Publish\Core\FieldType\ValidationError[]
23
     */
24
    protected $errors;
25
26
    public function __construct(APIContentFieldValidationException $e)
27
    {
28
        $this->errors = $e->getFieldErrors();
29
30
        parent::__construct($e->getMessage(), $e->getCode(), $e);
31
    }
32
33
    /**
34
     * Returns an array of field validation error messages.
35
     *
36
     * @return \eZ\Publish\Core\FieldType\ValidationError[]
37
     */
38
    public function getFieldErrors()
39
    {
40
        return $this->errors;
41
    }
42
}
43