Skip to content

Latest commit

 

History

History
27 lines (21 loc) · 531 Bytes

NormalizationFieldMapping.md

File metadata and controls

27 lines (21 loc) · 531 Bytes

NormalizationFieldMapping

<?php

use Chubbyphp\Serialization\Accessor\PropertyAccessor;
use Chubbyphp\Serialization\Normalizer\FieldNormalizer;
use Chubbyphp\Serialization\Mapping\NormalizationFieldMapping;

$fieldMapping = new NormalizationFieldMapping(
    'name',
    ['group1'],
    new FieldNormalizer(
        new PropertyAccessor('name')
    )
);

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

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

$fieldMapping
    ->getFieldNormalizer()
    ->normalizeField(...);