Passed
Push — master ( 6d9628...eb888e )
by Tobias
11:45
created

EntityExist::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 6
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Happyr\Validator\Constraint;
6
7
use Symfony\Component\Validator\Constraint;
8
9
/**
10
 * @Annotation
11
 *
12
 * @author Radoje Albijanic <[email protected]>
13
 */
14
#[\Attribute(\Attribute::TARGET_PROPERTY)]
15
final class EntityExist extends Constraint
16
{
17
    public $message = 'Entity "%entity%" with property "%property%": "%value%" does not exist.';
18
    public $property = 'id';
19
    public $entity;
20
21
    public function __construct($entity = null, $property = null, $message = null, $options = null, array $groups = null, $payload = null)
22
    {
23
        parent::__construct($options, $groups, $payload);
24
25
        $this->entity = $entity ?? $this->entity;
26
        $this->property = $property ?? $this->property;
27
        $this->message = $message ?? $this->message;
28
    }
29
}
30