我想知道如何覆盖 EasyAdminBundle 控制器。实际上,我想从数据库中编写一些自定义查询,我不想使用 dqlFilter。
以下是我的 config.yml 文件。
easy_admin:
site_name: 'site mame .'
entities:
User:
class: EmployeeBundle\Entity\EmployeeLogin
controller: EmployeeBundle\Controller\UserController
form:
fields: ['id', {property : 'userName', label : 'Users'}, {property: 'status', type:'choice', type_options: {choices: {'Active':'1', 'Deactive':'0'}}}]
new:
title: 'Add Login'
form_options: { validation_groups: ['Default', 'EmployeeLogin'] }
fields: ['-id']
edit:
title: 'Edit Login Details'
form_options: { validation_groups: ['Default'] }
label: 'Employees'
list:
title: "%%entity_label%% customers"
help: 'The list view overrides the global help message'
fields: ['id', {property : 'userName', label : 'Users'}, {property: 'status', type: 'boolean'}, {property : 'lastLogin',format: 'D j-n-Y, h:i:s'}]
这是我扩展 BaseAdminController 的 UserController 请让我知道如何从存储库或控制器中自定义查询
namespace EmployeeBundle\Controller;
use JavierEguiluz\Bundle\EasyAdminBundle\Controller\AdminController as BaseAdminController;
use Symfony\Component\HttpFoundation\Request;
class UserController extends BaseAdminController
{
public function listUserAction()
{
}
}