Error on filter with related DF 2.3.1


#1

Hi there!

I have a table services and clients.
I’m need a request with filter and related but when request not found register in my table services this request broke.
but the returned error is strange.

below is my request and error returned.

Request method GET

/api/v2/db-servicos/_table/services?fields=id&related=clients_by_service_id&filter=(status%20%3D%201)%20and%20(seller_id%20%3D%204)

ERROR

{
  "error": {
    "context": null,
    "message": "Filter value lists must be wrapped in parentheses.",
    "code": 400,
    "trace": [
      "0 /var/www/dreamfactory/vendor/dreamfactory/df-sqldb/src/Resources/Table.php(1240): DreamFactory\\Core\\SqlDb\\Resources\\Table->retrieveVirtualRecords('db-servicos', '_table/clients', Array)",
      "1 /var/www/dreamfactory/vendor/dreamfactory/df-sqldb/src/Resources/Table.php(1005): DreamFactory\\Core\\SqlDb\\Resources\\Table->retrieveRelationRecords(Object(DreamFactory\\Core\\Database\\Schema\\TableSchema), Object(DreamFactory\\Core\\Database\\Schema\\RelationSchema), Array, Array)",
      "2 /var/www/dreamfactory/vendor/dreamfactory/df-sqldb/src/Resources/Table.php(368): DreamFactory\\Core\\SqlDb\\Resources\\Table->retrieveRelatedRecords(Object(DreamFactory\\Core\\Database\\Schema\\TableSchema), Array, Array, Array)",
      "3 /var/www/dreamfactory/vendor/dreamfactory/df-sqldb/src/Resources/Table.php(239): DreamFactory\\Core\\SqlDb\\Resources\\Table->runQuery('services', 'id', Object(Illuminate\\Database\\Query\\Builder), Array)",
      "4 /var/www/dreamfactory/vendor/dreamfactory/df-core/src/Resources/BaseDbTableResource.php(391): DreamFactory\\Core\\SqlDb\\Resources\\Table->retrieveRecordsByFilter('services', '(status = 1) an...', Array, Array)",
      "5 [internal function]: DreamFactory\\Core\\Resources\\BaseDbTableResource->handleGet()",
      "6 /var/www/dreamfactory/vendor/dreamfactory/df-core/src/Components/RestHandler.php(327): call_user_func(Array)",
      "7 /var/www/dreamfactory/vendor/dreamfactory/df-core/src/Components/RestHandler.php(185): DreamFactory\\Core\\Components\\RestHandler->processRequest()",
      "8 /var/www/dreamfactory/vendor/dreamfactory/df-core/src/Components/RestHandler.php(243): DreamFactory\\Core\\Components\\RestHandler->handleRequest(Object(DreamFactory\\Core\\Utility\\ServiceRequest), 'services')",
      "9 /var/www/dreamfactory/vendor/dreamfactory/df-core/src/Services/BaseDbService.php(117): DreamFactory\\Core\\Components\\RestHandler->handleResource(Array)",
      "10 /var/www/dreamfactory/vendor/dreamfactory/df-core/src/Components/RestHandler.php(160): DreamFactory\\Core\\Services\\BaseDbService->handleResource(Array)",
      "11 /var/www/dreamfactory/vendor/dreamfactory/df-core/src/Services/BaseRestService.php(89): DreamFactory\\Core\\Components\\RestHandler->handleRequest(Object(DreamFactory\\Core\\Utility\\ServiceRequest), '_table/services')",
      "12 /var/www/dreamfactory/bootstrap/cache/compiled.php(17202): DreamFactory\\Core\\Services\\BaseRestService->handleRequest(Object(DreamFactory\\Core\\Utility\\ServiceRequest), '_table/services')",
      "13 /var/www/dreamfactory/bootstrap/cache/compiled.php(17163): DreamFactory\\Http\\Controllers\\RestController->handleService('v2', 'db-servicos', '_table/services')",
      "14 [internal function]: DreamFactory\\Http\\Controllers\\RestController->handleGET('v2', 'db-servicos', '_table/services')",
      "15 /var/www/dreamfactory/bootstrap/cache/compiled.php(9138): call_user_func_array(Array, Array)",
      "16 /var/www/dreamfactory/bootstrap/cache/compiled.php(9200): Illuminate\\Routing\\Controller->callAction('handleGET', Array)",
      "17 /var/www/dreamfactory/bootstrap/cache/compiled.php(9180): Illuminate\\Routing\\ControllerDispatcher->call(Object(DreamFactory\\Http\\Controllers\\RestController), Object(Illuminate\\Routing\\Route), 'handleGET')",
      "18 [internal function]: Illuminate\\Routing\\ControllerDispatcher->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))",
      "19 /var/www/dreamfactory/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(52): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
      "20 /var/www/dreamfactory/bootstrap/cache/compiled.php(17379): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))",
      "21 [internal function]: DreamFactory\\Http\\Middleware\\AccessCheck->handle(Object(Illuminate\\Http\\Request), Object(Closure))",
      "22 /var/www/dreamfactory/bootstrap/cache/compiled.php(9677): call_user_func_array(Array, Array)",
      "23 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))",
      "24 /var/www/dreamfactory/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
      "25 [internal function]: Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))",
      "26 /var/www/dreamfactory/bootstrap/cache/compiled.php(9662): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
      "27 /var/www/dreamfactory/bootstrap/cache/compiled.php(9181): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))",
      "28 /var/www/dreamfactory/bootstrap/cache/compiled.php(9168): Illuminate\\Routing\\ControllerDispatcher->callWithinStack(Object(DreamFactory\\Http\\Controllers\\RestController), Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request), 'handleGET')",
      "29 /var/www/dreamfactory/bootstrap/cache/compiled.php(8238): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request), 'DreamFactory\\Ht...', 'handleGET')",
      "30 /var/www/dreamfactory/bootstrap/cache/compiled.php(8225): Illuminate\\Routing\\Route->runController(Object(Illuminate\\Http\\Request))",
      "31 /var/www/dreamfactory/bootstrap/cache/compiled.php(7939): Illuminate\\Routing\\Route->run(Object(Illuminate\\Http\\Request))",
      "32 [internal function]: Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))",
      "33 /var/www/dreamfactory/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(52): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
      "34 [internal function]: Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))",
      "35 /var/www/dreamfactory/bootstrap/cache/compiled.php(9662): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
      "36 /var/www/dreamfactory/bootstrap/cache/compiled.php(7940): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))",
      "37 /var/www/dreamfactory/bootstrap/cache/compiled.php(7931): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))",
      "38 /var/www/dreamfactory/bootstrap/cache/compiled.php(7921): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))",
      "39 /var/www/dreamfactory/bootstrap/cache/compiled.php(2419): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))",
      "40 [internal function]: Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))",
      "41 /var/www/dreamfactory/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(52): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
      "42 /var/www/dreamfactory/app/Http/Middleware/AuthCheck.php(183): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))",
      "43 [internal function]: DreamFactory\\Http\\Middleware\\AuthCheck->handle(Object(Illuminate\\Http\\Request), Object(Closure))",
      "44 /var/www/dreamfactory/bootstrap/cache/compiled.php(9677): call_user_func_array(Array, Array)",
      "45 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))",
      "46 /var/www/dreamfactory/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
      "47 /var/www/dreamfactory/vendor/barryvdh/laravel-cors/src/HandleCors.php(34): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))",
      "48 [internal function]: Barryvdh\\Cors\\HandleCors->handle(Object(Illuminate\\Http\\Request), Object(Closure))",
      "49 /var/www/dreamfactory/bootstrap/cache/compiled.php(9677): call_user_func_array(Array, Array)",
      "50 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))",
      "51 /var/www/dreamfactory/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
      "52 /var/www/dreamfactory/bootstrap/cache/compiled.php(17483): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))",
      "53 [internal function]: DreamFactory\\Http\\Middleware\\FirstUserCheck->handle(Object(Illuminate\\Http\\Request), Object(Closure))",
      "54 /var/www/dreamfactory/bootstrap/cache/compiled.php(9677): call_user_func_array(Array, Array)",
      "55 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))",
      "56 /var/www/dreamfactory/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
      "57 /var/www/dreamfactory/bootstrap/cache/compiled.php(13188): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))",
      "58 [internal function]: Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))",
      "59 /var/www/dreamfactory/bootstrap/cache/compiled.php(9677): call_user_func_array(Array, Array)",
      "60 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))",
      "61 /var/www/dreamfactory/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
      "62 /var/www/dreamfactory/bootstrap/cache/compiled.php(11678): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))",
      "63 [internal function]: Illuminate\\Session\\Middleware\\StartSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))",
      "64 /var/www/dreamfactory/bootstrap/cache/compiled.php(9677): call_user_func_array(Array, Array)",
      "65 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))",
      "66 /var/www/dreamfactory/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
      "67 /var/www/dreamfactory/bootstrap/cache/compiled.php(12927): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))",
      "68 [internal function]: Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle(Object(Illuminate\\Http\\Request), Object(Closure))",
      "69 /var/www/dreamfactory/bootstrap/cache/compiled.php(9677): call_user_func_array(Array, Array)",
      "70 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))",
      "71 /var/www/dreamfactory/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
      "72 /var/www/dreamfactory/bootstrap/cache/compiled.php(12864): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))",
      "73 [internal function]: Illuminate\\Cookie\\Middleware\\EncryptCookies->handle(Object(Illuminate\\Http\\Request), Object(Closure))",
      "74 /var/www/dreamfactory/bootstrap/cache/compiled.php(9677): call_user_func_array(Array, Array)",
      "75 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))",
      "76 /var/www/dreamfactory/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
      "77 /var/www/dreamfactory/bootstrap/cache/compiled.php(3286): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))",
      "78 [internal function]: Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode->handle(Object(Illuminate\\Http\\Request), Object(Closure))",
      "79 /var/www/dreamfactory/bootstrap/cache/compiled.php(9677): call_user_func_array(Array, Array)",
      "80 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))",
      "81 /var/www/dreamfactory/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
      "82 [internal function]: Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))",
      "83 /var/www/dreamfactory/bootstrap/cache/compiled.php(9662): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
      "84 /var/www/dreamfactory/bootstrap/cache/compiled.php(2366): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))",
      "85 /var/www/dreamfactory/bootstrap/cache/compiled.php(2350): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))",
      "86 /var/www/dreamfactory/public/index.php(53): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))",
      "87 {main}"
    ]
  }
}


#2

Did you ever get an answer to this? I get the same error on my queries.


#3

Same Error, Error only when there are no results.


#4

You might be able to workaround that by letting a script check for this specific case and return no results instead of an error.