@@ -72,7 +72,7 @@ public function configure(FieldDto $field, EntityDto $entityDto, AdminContext $c
7272
7373 $ sourceCrudControllerFqcn = Type \class_string (CrudControllerInterface::class)->coerce ($ crud ->getControllerFqcn ());
7474
75- $ targetEntityFqcn = Type \string ()->coerce ($ context ->getCrudControllers ()->findEntityFqcnByCrudFqcn ($ targetCrudControllerFqcn ));
75+ $ targetEntityFqcn = Type \string ()->coerce ($ context ->getAdminControllers ()->findEntityByCrudController ($ targetCrudControllerFqcn ));
7676 invariant (Class \exists ($ targetEntityFqcn ), 'Could not determine target entity for set CRUD controller. ' );
7777 invariant (Class \exists ($ targetCrudControllerFqcn ), 'Could not determine target CRUD controller. ' );
7878
@@ -106,6 +106,10 @@ public function configure(FieldDto $field, EntityDto $entityDto, AdminContext $c
106106 $ widgetMode = Type \string ()->coerce ($ field ->getCustomOption (EntityField::OPTION_WIDGET ));
107107 if ($ widgetMode === EntityField::WIDGET_AUTOCOMPLETE ) {
108108 $ field ->setFormTypeOption ('attr.data-ea-widget ' , 'ea-autocomplete ' );
109+
110+ // both autocomplete(renderAsHtml: true) and renderAsHtml(true) set the same option.
111+ // OPTION_ESCAPE_HTML_CONTENTS has inverted logic (true = escape, false = render as HTML)
112+ $ field ->setFormTypeOption ('attr.data-ea-autocomplete-render-items-as-html ' , $ field ->getCustomOption (EntityField::OPTION_ESCAPE_HTML_CONTENTS ) === true ? 'false ' : 'true ' );
109113 } elseif ($ widgetMode === EntityField::WIDGET_NATIVE ) {
110114 $ field ->setFormTypeOption ('class ' , $ entityMetadata ->targetEntityFqcn ());
111115 }
@@ -134,14 +138,16 @@ public function configure(FieldDto $field, EntityDto $entityDto, AdminContext $c
134138 } else {
135139 $ field ->setFormTypeOptionIfNotSet ('query_builder ' , static function (EntityRepository $ repository ) use ($ field ): QueryBuilder {
136140 // it would then be identical to the one used in autocomplete action, but it is a bit complex getting it in here
137- $ queryBuilder = $ repository ->createQueryBuilder ('entity ' );
141+ $ queryBuilder = $ repository ->createQueryBuilder ('entity ' );
142+ /** @var (callable(QueryBuilder): QueryBuilder)|null $queryBuilderCallable */
138143 $ queryBuilderCallable = $ field ->getCustomOption (EntityField::OPTION_QUERY_BUILDER_CALLABLE );
139144 if ($ queryBuilderCallable !== null ) {
140145 invariant (
141146 is_callable ($ queryBuilderCallable ),
142147 Str \format ('Query builder callable option is not null or callable. ' ),
143148 );
144- $ queryBuilderCallable ($ queryBuilder );
149+
150+ return $ queryBuilderCallable ($ queryBuilder );
145151 }
146152
147153 return $ queryBuilder ;
0 commit comments