public function visitArray($data, array $type, Context $context)
{
$types = array('NULL', 'string', 'integer', 'boolean', 'double', 'float', 'array', 'ArrayCollection');
if (is_array($data) && count($type['params']) === 1 && !empty($type['params'][0]['name'])) {
foreach ($data as $key => $value) {
if (is_scalar($value) && !in_array($type['params'][0]['name'], $types)) {
/** @var DeserializationContext $context */
$context->useDoctrineConstructor();
$data[$key] = array('id' => $value);
}
}
}
return parent::visitArray($data, $type, $context);
}