Skip to content

Latest commit

 

History

History
28 lines (22 loc) · 648 Bytes

DenormalizationFieldMappingBuilder.md

File metadata and controls

28 lines (22 loc) · 648 Bytes

DenormalizationFieldMappingBuilder

<?php

use Chubbyphp\Deserialization\Accessor\PropertyAccessor;
use Chubbyphp\Deserialization\Denormalizer\FieldDenormalizer;
use Chubbyphp\Deserialization\Mapping\DenormalizationFieldMappingBuilder;

$fieldMapping = DenormalizationFieldMappingBuilder::create('name')
    ->setGroups(['group1'])
    ->setFieldDenormalizer(
        new FieldDenormalizer(
            new PropertyAccessor('name')
        )
    )
    ->getMapping();

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

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

$fieldMapping
    ->getFieldDenormalizer()
    ->denormalizeField(...);