ネストされた 3 つのオブジェクト プロパティを持つオブジェクトをシリアル化しようとすると、
エラー: 最大関数ネスト レベル '250' に達しました
Entity Volunteer には、OneToOne with Person、OnetoMany with Focuses、および OneToMany with Skills があります。応答がシリアル化されている場合$volunteer->getPerson();
、期待される json 応答が発生します。ただし、$volunteer->getFocuses();
最大ネスティング レベル エラーも発生します。
アップデート
xdebug の最大値を増やすと、開発環境では 30 秒でタイムアウトします。
コントローラーのスニペット:
$em = $this->getDoctrine()->getManager();
$serializer = \JMS\Serializer\SerializerBuilder::create()->build();
$volunteer = $em->getRepository('HOTV2Bundle:Volunteer')->find($id);
$response = new JsonResponse($serializer->serialize($volunteer, 'json'));