@@ -168,6 +168,8 @@ public function configure(FieldDto $field, EntityDto $entityDto, AdminContext $c
168168 EA ::CRUD_CONTROLLER_FQCN => $ context ->getRequest ()->attributes ->get (EA ::CRUD_CONTROLLER_FQCN ) ?? $ context ->getRequest ()->query ->get (EA ::CRUD_CONTROLLER_FQCN ),
169169 'propertyName ' => $ propertyName ,
170170 'originatingPage ' => $ context ->getCrud ()->getCurrentPage (),
171+ EA ::ENTITY_ID => $ entityDto ->getPrimaryKeyValueAsString (),
172+ EA ::ENTITY_FQCN => $ entityDto ->getFqcn (),
171173 ])
172174 ->generateUrl ();
173175 } catch (RouteNotFoundException $ e ) {
@@ -177,12 +179,12 @@ public function configure(FieldDto $field, EntityDto $entityDto, AdminContext $c
177179
178180 $ field ->setFormTypeOption ('attr.data-ea-autocomplete-endpoint-url ' , $ autocompleteEndpointUrl ?? null );
179181 } else {
180- $ field ->setFormTypeOptionIfNotSet ('query_builder ' , static function (EntityRepository $ repository ) use ($ field ) {
182+ $ field ->setFormTypeOptionIfNotSet ('query_builder ' , static function (EntityRepository $ repository ) use ($ entityDto , $ field ) {
181183 // TODO: should this use `createIndexQueryBuilder` instead, so we get the default ordering etc.?
182184 // it would then be identical to the one used in autocomplete action, but it is a bit complex getting it in here
183185 $ queryBuilder = $ repository ->createQueryBuilder ('entity ' );
184186 if (null !== $ queryBuilderCallable = $ field ->getCustomOption (AssociationField::OPTION_QUERY_BUILDER_CALLABLE )) {
185- $ queryBuilderCallable ($ queryBuilder );
187+ $ queryBuilderCallable ($ queryBuilder, $ entityDto );
186188 }
187189
188190 return $ queryBuilder ;
0 commit comments