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

Latest commit

 

History

History
30 lines (23 loc) · 650 Bytes

ValidationPropertyMappingBuilder.md

File metadata and controls

30 lines (23 loc) · 650 Bytes

ValidationPropertyMappingBuilder

<?php

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

$fieldMapping = ValidationPropertyMappingBuilder
    ::create(
        'name',
        [new NotNullConstraint()]
    )
    ->setGroups(['group1'])
    ->setAccessor(new PropertyAccessor('name'))
    ->getMapping();

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

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

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

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