Skip to content

Latest commit

 

History

History
28 lines (21 loc) · 623 Bytes

CallableDenormalizationObjectMapping.md

File metadata and controls

28 lines (21 loc) · 623 Bytes

CallableDenormalizationObjectMapping

<?php

use Chubbyphp\Deserialization\Mapping\CallableDenormalizationObjectMapping;
use MyProject\Mapping\ModelMapping;
use MyProject\Model\Model;

$objectMapping = new CallableDenormalizationObjectMapping(
    Model::class,
    function () {
        return new ModelMapping();
    }
);

echo $objectMapping->getClass();
// 'MyProject\Model\Model'

$callable = $objectMapping->getFactory('');
$model = $callable();

echo get_class($model);
// 'MyProject\Model\Model'

$objectMapping->getDenormalizationFieldMappings('');
// array<int, DenormalizationFieldMappingInterface>