Add repositories in CRUD_DETAIL with configureResponseParameters on EasyAdmin Bundle V3

599 views Asked by At

I try to customize my user CRUD detail on EasyAdmin Bundle 3. After inserting user info, I need to get all 'child' users associated to the user. (defined by a field 'ParentId', I need to make a repository on user Entity to select all user with parentId = entityId).

In order to do this, I wanted to use the function : public function configureResponseParameters(KeyValueStore $responseParameters): KeyValueStore

But I don't know how to pass the entityId into this function to make the request on the userRepository.

Do you have any info about this ?

Thanks for your help !

1

There are 1 answers

0
Romaric PIBOLLEAU On

OK, I found my answer :

public function configureResponseParameters(KeyValueStore $responseParameters): KeyValueStore
    {
        $entityId = $responseParameters->get('entity')->getInstance()->getId();

       //and with this entityId, I can call an EntityManager and get my repositories...

   }