【发布时间】:2022-01-02 11:19:36
【问题描述】:
即使我尝试在我的 propertyController 中调用 Doctrine ORM 包,我也有以下错误。我不知道我错过了什么。
未定义的方法'getDoctrine'.intelephense(1013)
namespace App\Controller;
use App\Entity\Property;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bridge\Doctrine\ManagerRegistry;
class propertyController extends AbstractController
{
/**
* @Route("/billets",name="property.index")
* @return Response
*/
public function index():Response{
$repostory= $this->getDoctrine()->getRepository(Property::class);
return $this->render("proprety/index.html.twig",[
'current_menu' => 'properties'
]);
}
}
【问题讨论】:
标签: php doctrine-orm controller doctrine symfony5