From 687ebcb93d8d09888130451cec9944b0b4a9f37a Mon Sep 17 00:00:00 2001 From: Awilum Date: Thu, 17 Dec 2020 10:24:26 +0300 Subject: [PATCH] feat(rest-api): add ability to call macroable fetch methods in Entries Rest API #505 --- src/flextype/Endpoints/entries.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/flextype/Endpoints/entries.php b/src/flextype/Endpoints/entries.php index 07a227f4..fb284b60 100644 --- a/src/flextype/Endpoints/entries.php +++ b/src/flextype/Endpoints/entries.php @@ -77,13 +77,13 @@ flextype()->get('/api/entries', function (Request $request, Response $response) // override entries.fetch.result flextype('registry')->set('flextype.settings.entries.fields.entries.fetch.result', 'toArray'); - if (isset($method) && - strings($method)->contains('fetch') && - is_callable([flextype('entries'), $method])) { - $fetchFromCallbackMethod = $method; - } else { - $fetchFromCallbackMethod = 'fetch'; - } + if (isset($method) && + str_contains($method, 'fetch') && + is_callable([flextype('entries'), $method])) { + $fetchFromCallbackMethod = $method; + } else { + $fetchFromCallbackMethod = 'fetch'; + } // Get fetch result $response_data['data'] = flextype('entries')->{$fetchFromCallbackMethod}($id, $options);