2017-09-14 1 views
0

EasyAdminBundle 컨트롤러를 재정의하는 방법을 알고 싶습니다. 사실, 데이터베이스에서 사용자 지정 쿼리를 작성하고 dqlFilter를 사용하고 싶지 않습니다.easyAdminBundle 컨트롤러를 재정의하는 방법

다음은 내 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는 제가

namespace EmployeeBundle\Controller; 

use JavierEguiluz\Bundle\EasyAdminBundle\Controller\AdminController as BaseAdminController; 
use Symfony\Component\HttpFoundation\Request; 

class UserController extends BaseAdminController 
{ 
    public function listUserAction() 
    { 

    } 
} 
+0

봐()'공급 업체에서/javiereguiluz/easyadmin-번들/컨트롤러/AdminController.php – COil

답변

0
내가 이런 짓을

저장소에서 또는 컨트롤러에서 쿼리를 사용자 정의 할 수있는 방법을 알려 주시기 바랍니다 확장 내 UserController이며, 그것이 도움이 될 것입니다 희망했다 다른 사람 :은`listAction에서

public function createListQueryBuilder($entityClass, $sortDirection, $sortField = null, $dqlFilter = null) 
     { 
      $response = parent::createListQueryBuilder('EmployeeLogin, EmployeeMaster', $sortDirection, $sortField, $dqlFilter); // TODO: Change the autogenerated stub 


      $response->join('entity.userId','emp'); 
      $response->andWhere('emp.lastName = :role')->setParameter('role', 'sagir'); 

      return $response; 
관련 문제