b2pweb /
bdf-form
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Bdf\Form\Constraint; |
||
| 4 | |||
| 5 | use Bdf\Form\Util\FieldPath; |
||
| 6 | use Symfony\Component\Validator\Constraint; |
||
| 7 | |||
| 8 | /** |
||
| 9 | * Add field option on comparison class |
||
| 10 | * The class must extends a subclass of AbstractComparison |
||
| 11 | */ |
||
| 12 | trait FieldComparisonTrait |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * The field path |
||
| 16 | * |
||
| 17 | * @var string|FieldPath |
||
| 18 | */ |
||
| 19 | public $field; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * FieldComparisonTrait constructor. |
||
| 23 | * @param string|FieldPath|array $field |
||
| 24 | */ |
||
| 25 | 8 | public function __construct($field) |
|
| 26 | { |
||
| 27 | 8 | Constraint::__construct($field); |
|
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 28 | 8 | } |
|
| 29 | |||
| 30 | /** |
||
| 31 | * {@inheritdoc} |
||
| 32 | */ |
||
| 33 | 8 | public function getDefaultOption(): ?string |
|
| 34 | { |
||
| 35 | 8 | return 'field'; |
|
| 36 | } |
||
| 37 | } |
||
| 38 |