File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 22
33namespace EasyCorp \Bundle \EasyAdminBundle \Dto ;
44
5- use Closure ;
65use EasyCorp \Bundle \EasyAdminBundle \Config \Crud ;
76use EasyCorp \Bundle \EasyAdminBundle \Config \KeyValueStore ;
87use EasyCorp \Bundle \EasyAdminBundle \Field \DateTimeField ;
@@ -468,6 +467,10 @@ public function getAutocompleteEntityNormalizer(): ?\Closure
468467
469468 public function setAutocompleteEntityNormalizer (?callable $ autocompleteEntityNormalizer ): void
470469 {
471- $ this ->autocompleteEntityNormalizer = $ autocompleteEntityNormalizer ? \Closure::fromCallable ($ autocompleteEntityNormalizer ) : null ;
470+ if ($ autocompleteEntityNormalizer ) {
471+ $ autocompleteEntityNormalizer = \Closure::fromCallable ($ autocompleteEntityNormalizer );
472+ }
473+
474+ $ this ->autocompleteEntityNormalizer = $ autocompleteEntityNormalizer ;
472475 }
473476}
Original file line number Diff line number Diff line change @@ -204,9 +204,14 @@ public function getResultsAsJson(?\Closure $entityAsStringNormalizer = null): st
204204 foreach ($ this ->getResults () ?? [] as $ entityInstance ) {
205205 $ entityDto = $ this ->entityFactory ->createForEntityInstance ($ entityInstance );
206206
207+ $ entityAsString = $ entityDto ->toString ();
208+ if ($ entityAsStringNormalizer ) {
209+ $ entityAsString = $ entityAsStringNormalizer ($ entityInstance );
210+ }
211+
207212 $ jsonResult ['results ' ][] = [
208213 EA ::ENTITY_ID => $ entityDto ->getPrimaryKeyValueAsString (),
209- 'entityAsString ' => $ entityAsStringNormalizer ? $ entityAsStringNormalizer ( $ entityInstance ) : $ entityDto -> toString () ,
214+ 'entityAsString ' => $ entityAsString ,
210215 ];
211216 }
212217
You can’t perform that action at this time.
0 commit comments