Unable to guess how to get a Doctrine instance from the request information

前端 未结 5 2402
青春惊慌失措
青春惊慌失措 2021-02-18 17:16

I\'ve got this \"500 Internal Server Error - LogicException: Unable to guess how to get a Doctrine instance from the request information\".

Here is my c

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-18 18:04

    The Doctrine doesn't know how to use request parameters in order to query entities specified in the function's signature.

    You will need to help it by specifying some mapping information:

    /**
      * @Route("/gatherplayer/{player_name}/{gather_id}")
      *
      * @ParamConverter("player", options={"mapping": {"player_name" : "name"}})
      * @ParamConverter("gather", options={"mapping": {"gather_id"   : "id"}})
      *
      * @Template()
      */
    public function createAction(Player $player, Gather $gather)
    {
      // ...
    }
    

提交回复
热议问题