Skip to content

Commit 75e0c47

Browse files
Merge pull request #176 from MarcinOrlowski/dev
Release 9.1.0
2 parents 9a15037 + b3a1252 commit 75e0c47

File tree

6 files changed

+457
-372
lines changed

6 files changed

+457
-372
lines changed

CHANGES.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,16 @@ before doing major upgrade!
88

99
## CHANGE LOG ##
1010

11+
* v9.1.0 (2020-10-29)
12+
* [RB-175] `Paginator` and `LengthAwarePaginator` support is now included in default converter
13+
configuration (reported by @kcaj-burr)
14+
* Fixed `testConfigClassesMappingEntriesUnwantedConfigKeys()` testing trait not supporting
15+
`null` keys in converter config.
16+
1117
* v9.0.3 (2020-10-27)
1218
* `Validator` type related exceptions must now implement `InvalidTypeExceptionContract`.
13-
* `converter` config `key` element now accepts `null` to indicate you want no key to be used.
19+
* The `converter` config `key` element now accepts `null` to indicate you want no key to
20+
be used (patch by Raja)
1421

1522
* v9.0.2 (2020-10-24)
1623
* Corrected tests to use regular ServiceProvider.
@@ -32,7 +39,7 @@ before doing major upgrade!
3239

3340
* v8.1.1 (2020-10-15)
3441
* [RB-155] Fixed `ResponseBuilder` internals preventing exdending class code from
35-
being invoked, thus making response object structure manipulation ineffective (reported by krek95).
42+
being invoked, thus making response object structure manipulation ineffective (reported by @krek95).
3643

3744
* v8.1.0 (2020-09-17)
3845
* Added logging (`.env` controllable) for payload Converter to help debugging inproper data conversion.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "marcin-orlowski/laravel-api-response-builder",
33
"description": "Helps building nice, normalized and easy to consume Laravel REST API.",
44
"homepage": "https://github.com/MarcinOrlowski/laravel-api-response-builder",
5-
"version": "9.0.3",
5+
"version": "9.1.0",
66
"keywords": [
77
"laravel",
88
"json",

config/response_builder.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,23 @@
7979
'pri' => 0,
8080
],
8181

82+
/*
83+
|-----------------------------------------------------------------------------------------------------------
84+
| Paginators converts to objects already, so we do not array wrapping here, hence setting `key` to null
85+
|-----------------------------------------------------------------------------------------------------------
86+
*/
87+
88+
\Illuminate\Pagination\LengthAwarePaginator::class => [
89+
'handler' => \MarcinOrlowski\ResponseBuilder\Converters\ArrayableConverter::class,
90+
'key' => null,
91+
'pri' => 0,
92+
],
93+
\Illuminate\Pagination\Paginator::class => [
94+
'handler' => \MarcinOrlowski\ResponseBuilder\Converters\ArrayableConverter::class,
95+
'key' => null,
96+
'pri' => 0,
97+
],
98+
8299
/*
83100
|-----------------------------------------------------------------------------------------------------------
84101
| Generic converters should have lower pri to allow dedicated ones to kick in first when class matches

docs/config.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ php artisan vendor:publish
6767

6868
```php
6969
'converter' => [
70-
\Illuminate\Database\Eloquent\Model::class => [
70+
\Illuminate\Database\Eloquent\Model::class => [
7171
'handler' => \MarcinOrlowski\ResponseBuilder\Converters\ToArrayConverter::class,
7272
'key' => 'items',
73-
// 'pri' => 0,
73+
'pri' => 0,
7474
],
75-
\Illuminate\Database\Eloquent\Collection::class => [
76-
'handler' => \MarcinOrlowski\ResponseBuilder\Converters\ToArrayConverter::class,
77-
'key' => 'items',
78-
// 'pri' => 0,
75+
\Illuminate\Pagination\Paginator::class => [
76+
'handler' => \MarcinOrlowski\ResponseBuilder\Converters\ArrayableConverter::class,
77+
'key' => null,
78+
'pri' => 0,
7979
],
8080
],
8181
```

0 commit comments

Comments
 (0)