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

前端 未结 5 2397
青春惊慌失措
青春惊慌失措 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 17:38

    /**
     * @Route("/gatherplayer/{name}/{id}")
     * @Template()
     */
    public function createAction(Player $player, Gather $gather)
    

    I didn't find any help in paramconverter's (poor?) documentation, since it doesn't describe how it works, how it guesses with more than one parameters and stuff. Plus I'm not sure it's needed since what I just wrote works properly.

    My mystake was not to use the name of my attributs so doctrine couldn't guess right. I changed {player_name} to {name} and {gather_id} to {id}.

    Then I changed the names of my id in their entities from "id" to "id_gather" and "id_player" so I'm now able to do that :

    /**
     * @Route("/gatherplayer/{id_player}/{id_gather}")
     * @Template()
     */
    public function createAction(Player $player, Gather $gather)
    

    which is a lot more effective than

     * @Route("/gatherplayer/{id}/{id}")
    

    Now I'm wondering how I can make this work

     /**
      * @Route("/gatherplayer/{player}/{gather}")
      * @Template()
      */
     public function deleteAction(Gather_Player $gather_player)
    

提交回复
热议问题