dingo / api

A RESTful API package for the Laravel and Lumen frameworks.
BSD 3-Clause "New" or "Revised" License
9.33k stars 1.25k forks source link

laravel 5.5 don`t receive model from api response #1571

Closed adzsolt closed 5 years ago

adzsolt commented 6 years ago
Q
Bug? yes
New Feature? no
Framework Laravel
Framework version 5.5.40
Package version 2.0.0
PHP version 7.1.9

Actual Behaviour

With Laravel 5.2 this call $products = $this->api->get($this->api_key . '/prods?status=1&locations=' . $this->location_id);

return

array:1 [▼ "products" => array:407 [▼ 0 => array:4 [▼ "product" => Product {#2000 ▶} "description" => ProductDescription {#2411 ▶} "id" => 63 "special" => "0.00"

after upgrade to Laravel 5.5 and dingo 2.0.0

array:1 [▼ "products" => array:407 [▼ 0 => array:4 [▼ "product" => array:26 [▶] "description" => array:12 [▶] "id" => 63 "special" => "0.00" ]

Why?

specialtactics commented 5 years ago

I don't overly understand what you mean, but if by response you mean what comes from the app - it should be in json (so the second is just php arrays to be mapped to json using json_encode) - and not any php objects.