Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 11
UserDataFormDataMapper
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 3
56
0.00% covered (danger)
0.00%
0 / 11
 mapDataToForms
0.00% covered (danger)
0.00%
0 / 1
20
0.00% covered (danger)
0.00%
0 / 7
 mapFormsToData
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 1
 configureOptions
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 3
<?php declare(strict_types = 1);
//
// Generated by Smalldb\CodeCooker\Generator\DtoGenerator.
// Do NOT edit! All changes will be lost!
// 
// 
namespace Smalldb\StateMachine\Test\Example\User\UserData;
use Smalldb\CodeCooker\Annotation\GeneratedClass;
use Symfony\Component\Form\DataMapperInterface;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
 * @GeneratedClass
 * @see \Smalldb\StateMachine\Test\Example\User\UserProperties
 */
class UserDataFormDataMapper implements DataMapperInterface
{
    public function mapDataToForms($viewData, iterable $forms)
    {
        if ($viewData === null) {
            return;
        } else if ($viewData instanceof UserData) {
            foreach ($forms as $prop => $field) {
                $field->setData(UserDataImmutable::get($viewData, $prop));
            }
        } else {
            throw new UnexpectedTypeException($viewData, UserDataImmutable::class);
        }
    }
    public function mapFormsToData(iterable $forms, & $viewData)
    {
        $viewData = UserDataImmutable::fromIterable($viewData, (function() use ($forms) { foreach($forms as $k => $field) yield $k => $field->getData(); })());
    }
    public function configureOptions(OptionsResolver $optionsResolver)
    {
        $optionsResolver->setDefault("empty_data", null);
        $optionsResolver->setDefault("data_class", UserData::class);
    }
}