如何在symfony 4中显示一个包含从关系数据库中获取的数据的表单作为下拉列表?

如何在symfony 4中显示一个包含从关系数据库中获取的数据的表单作为下拉列表?

问题描述:

Guide me suggestions to have a drop down with data's fetched from relational database in symfony 4

Referral link:

Relational Database

指导我建议下载从symfony 4中的关系数据库中提取的数据 p> \ n

推荐链接: p>

关系数据库 p> div>

In Controller

Add this line

$category = $this->getDoctrine() ->getRepository(Category::class) ->findAll();

In Twig

Add these lines in your twig