class Item
{
public $id;
//..getters and setters
}
$data = [['id' => 1], ['id' => 2]];
$serializer = new Serializer([new GetSetMethodNormalizer(), new ArrayDenormalizer()]);
$model = $serializer->denormalize($data, "Item[]");
dump($model);die;
Run Code Online (Sandbox Code Playgroud)
我收到错误:
Could not denormalize object of type Item[], no supporting normalizer found.
就像在这个例子中一样 - https://symfony.com/doc/current/components/serializer.html#handling-arrays 为什么我收到错误?