Doctrine cannot map entity/repository namespace in chain

后端 未结 4 1804
暗喜
暗喜 2021-01-24 17:44

I\'m trying to setup symfony with doctrine, configuring doctrine is new for me.

I try to retrieve a entity from the database by using the following code in my controller

4条回答
  •  闹比i
    闹比i (楼主)
    2021-01-24 18:17

    try this:

    $feedImport = $this->getDoctrine()->getRepository('AppBundle:MyClass');
    

    if you want to access a particular function/method

    $feedImport = $this->getDoctrine()->getRepository('AppBundle:MyClass')->sampleMethod();
    

提交回复
热议问题