diff --git a/src/flextype/Foundation/Entries/Fields/EntriesField.php b/src/flextype/Foundation/Entries/Fields/EntriesField.php index 49bae151..d6fbf88f 100644 --- a/src/flextype/Foundation/Entries/Fields/EntriesField.php +++ b/src/flextype/Foundation/Entries/Fields/EntriesField.php @@ -29,13 +29,14 @@ declare(strict_types=1); foreach (flextype('entries')->getStorage('fetch.data.entries.fetch') as $field => $body) { if (isset($body['method']) && - str_contains($body['method'], 'fetch') && + strpos($body['method'], 'fetch') !== false && is_callable([flextype('entries'), $body['method']])) { $fetchFromCallbackMethod = $body['method']; } else { $fetchFromCallbackMethod = 'fetch'; } + $result = isset($body['result']) && in_array($body['result'], ['toArray', 'toObject']) ? $body['result'] : $resultTo; $data[$field] = flextype('entries')->{$fetchFromCallbackMethod}($body['id'],