CodeExplorer prepareForDenormalization example
if (!
isset($context['cache_key'
])) { $context['cache_key'
] =
$this->
getCacheKey($format,
$context);
} $this->
validateCallbackContext($context);
if (null ===
$data &&
isset($context['value_type'
]) &&
$context['value_type'
] instanceof Type &&
$context['value_type'
]->
isNullable()) { return null;
} $allowedAttributes =
$this->
getAllowedAttributes($type,
$context, true
);
$normalizedData =
$this->
prepareForDenormalization($data);
$extraAttributes =
[];
$mappedClass =
$this->
getMappedClass($normalizedData,
$type,
$context);
$nestedAttributes =
$this->
getNestedAttributes($mappedClass);
$nestedData =
$originalNestedData =
[];
$propertyAccessor = PropertyAccess::
createPropertyAccessor();
foreach ($nestedAttributes as $property =>
$serializedPath) { if (null ===
$value =
$propertyAccessor->
getValue($normalizedData,
$serializedPath)) { continue;
} if (!
isset($context['cache_key'
])) { $context['cache_key'
] =
$this->
getCacheKey($format,
$context);
} $this->
validateCallbackContext($context);
if (null ===
$data &&
isset($context['value_type'
]) &&
$context['value_type'
] instanceof Type &&
$context['value_type'
]->
isNullable()) { return null;
} $allowedAttributes =
$this->
getAllowedAttributes($type,
$context, true
);
$normalizedData =
$this->
prepareForDenormalization($data);
$extraAttributes =
[];
$mappedClass =
$this->
getMappedClass($normalizedData,
$type,
$context);
$nestedAttributes =
$this->
getNestedAttributes($mappedClass);
$nestedData =
$originalNestedData =
[];
$propertyAccessor = PropertyAccess::
createPropertyAccessor();
foreach ($nestedAttributes as $property =>
$serializedPath) { if (null ===
$value =
$propertyAccessor->
getValue($normalizedData,
$serializedPath)) { continue;
}