大家好,大家都需要一点帮助,我没有找到有关递归规范化对象的响应
class User
{
public $email;
public $userId;
public $userName;
/**
* @var CustomAttributes
*/
public $customAttributes;
}
class CustomAttributes
{
public $someStuff;
public $someStuffHere;
}
Run Code Online (Sandbox Code Playgroud)
我只想通过symfony组件的normalize()将其转换为数组snake_case
$normalizer = new PropertyNormalizer(null, new CamelCaseToSnakeCaseNameConverter());
$user_normalize = $normalizer->normalize($user);
Run Code Online (Sandbox Code Playgroud)
但我有这个错误
在 AbstractObjectNormalizer.php 第 129 行:无法规范化属性“customAttributes”,因为注入的序列化器不是规范化器
谢谢你的帮助