Skip to content

Instantly share code, notes, and snippets.

@joelwurtz
Created Feb 14, 2019
Embed
What would you like to do?
<?php
final class Mapper_Symfony_Component_AutoMapper_Tests_Fixtures_User_Symfony_Component_AutoMapper_Tests_Fixtures_UserDTO extends \Symfony\Component\AutoMapper\GeneratedMapper
{
public function __construct()
{
$this->extractCallbacks['email'] = \Closure::bind(function ($object) {
return $object->email;
}, null, 'Symfony\\Component\\AutoMapper\\Tests\\Fixtures\\User');
}
public function &map($value, \Symfony\Component\AutoMapper\Context $context)
{
if (null === $value) {
return $value;
}
$result = $context->getObjectToPopulate();
if (null === $result) {
$result = new \Symfony\Component\AutoMapper\Tests\Fixtures\UserDTO();
}
$context = $context->withIncrementedDepth();
if ($context->isAllowedAttribute('name')) {
$result->name = $value->name;
}
if ($context->isAllowedAttribute('age')) {
$value_1 = $value->age;
if (is_string($value->age)) {
$value_1 = (int) $value->age;
}
if (is_int($value->age)) {
$value_1 = $value->age;
}
$result->age = $value_1;
}
if ($context->isAllowedAttribute('address')) {
$result->address = &$this->mappers['Mapper_Symfony\\Component\\AutoMapper\\Tests\\Fixtures\\Address_Symfony\\Component\\AutoMapper\\Tests\\Fixtures\\AddressDTO']->map($value->address, $context->withNewContext('address'));
}
if ($context->isAllowedAttribute('addresses')) {
$values = [];
foreach ($value->addresses as $value_2) {
$values[] = &$this->mappers['Mapper_Symfony\\Component\\AutoMapper\\Tests\\Fixtures\\Address_Symfony\\Component\\AutoMapper\\Tests\\Fixtures\\AddressDTO']->map($value_2, $context->withNewContext('addresses'));
}
$result->addresses = $values;
}
if ($context->isAllowedAttribute('createdAt')) {
$result->createdAt = $value->createdAt;
}
if ($context->isAllowedAttribute('id')) {
$result->id = $value->getId();
}
if ($context->isAllowedAttribute('email')) {
$result->email = $this->extractCallbacks['email']($value);
}
if ($context->isAllowedAttribute('yearOfBirth')) {
$result->yearOfBirth = $this->callbacks['yearOfBirth']($value);
}
return $result;
}
public function injectMappers(\Symfony\Component\AutoMapper\AutoMapperRegistryInterface $autoMapperRegistry): void
{
$this->mappers['Mapper_Symfony\\Component\\AutoMapper\\Tests\\Fixtures\\Address_Symfony\\Component\\AutoMapper\\Tests\\Fixtures\\AddressDTO'] = $autoMapperRegistry->getMapper('Symfony\\Component\\AutoMapper\\Tests\\Fixtures\\Address', 'Symfony\\Component\\AutoMapper\\Tests\\Fixtures\\AddressDTO');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment