Skip to content

How to use query_builder options? #1145

@zboina

Description

@zboina

How to manipulate the data in the form of easyadmin?
I would like to form in the type of entity (user choice) do query_builder options to select the entity only selected users:

'Query_builder' => function (EntityRepository $er)  {
    return $er-> createQueryBuilder('u') 
        ->where('u.type = ":type"') 
        ->setParameter(' type ', $type);
}

How to do it in easyadmin?
The file YML I can not do?

form:
    fields: 
        - {property: 'zastepca', type: entity,type_options: {expanded: false, multiple: false, class: 'UserBundle:User', ''Query_builder': ???  }}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions