Skip to content
This repository was archived by the owner on Jul 6, 2024. It is now read-only.

Latest commit

 

History

History
28 lines (21 loc) · 563 Bytes

File metadata and controls

28 lines (21 loc) · 563 Bytes

ValidationPropertyMapping

<?php

use Chubbyphp\Validation\Accessor\PropertyAccessor;
use Chubbyphp\Validation\Constraint\NotNullConstraint;
use Chubbyphp\Validation\Mapping\ValidationPropertyMapping;

$fieldMapping = new ValidationPropertyMapping(
    'name',
    [new NotNullConstraint()],
    ['group1'],
    new PropertyAccessor('name')
);

$fieldMapping->getName();
// 'name'

$fieldMapping->getConstraints();
// [new NotNullConstraint()]

$fieldMapping->getGroups();
// ['group1']

$fieldMapping->getAccessor();
// new PropertyAccessor('name')