Skip to content

Commit b4b49ec

Browse files
innocenzibrendt
authored andcommitted
refactor(mapper)!: move map function in Tempest\Mapper (#1789)
1 parent 2537d2a commit b4b49ec

File tree

47 files changed

+254
-84
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+254
-84
lines changed

docs/1-essentials/01-routing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ Once you have created a request class, you may simply inject it into a controlle
368368
```php app/AirportController.php
369369
use Tempest\Router\Post;
370370
use Tempest\Http\Responses\Redirect;
371-
use function Tempest\map;
371+
use function Tempest\Mapper\map;
372372
use function Tempest\Router\uri;
373373

374374
final readonly class AirportController

docs/1-essentials/03-database.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ final class Book
147147
Because model objects aren't tied to the database specifically, Tempest's [mapper](../2-features/01-mapper.md) can map data from many different sources to them. For instance, you can persist your models as JSON instead of a database, if you want to:
148148

149149
```php
150-
use function Tempest\map;
150+
use function Tempest\Mapper\map;
151151

152152
$books = map($json)->collection()->to(Book::class); // from JSON source to Book collection
153153
$json = map($books)->toJson(); // from Book collection to JSON

docs/2-features/01-mapper.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ You may map data from a source to a target using the `map()` function. This func
1616
Calling the `to()` method on this instance will return a new instance of the target class, populated with the mapped data:
1717

1818
```php
19-
use function Tempest\map;
19+
use function Tempest\Mapper\map;
2020

2121
$book = map($rawBookAsJson)->to(Book::class);
2222
```
@@ -26,7 +26,7 @@ $book = map($rawBookAsJson)->to(Book::class);
2626
When the source data is an array, you may instruct the mapper to map each item of the collection to an instance of the target class by calling the `collection()` method.
2727

2828
```php
29-
use function Tempest\map;
29+
use function Tempest\Mapper\map;
3030

3131
$books = map($rawBooksAsJson)
3232
->collection()
@@ -54,7 +54,7 @@ $result = map($rawBooksAsJson)
5454
Of course, `with()` can also be combined with `collection()` and `to()`.
5555

5656
```php
57-
use function Tempest\map;
57+
use function Tempest\Mapper\map;
5858

5959
$books = map($rawBooksAsJson)
6060
->collection()
@@ -235,4 +235,4 @@ $container->get(SerializerFactory::class)
235235
->addSerializer(Address::class, AddressSerializer::class);
236236
```
237237

238-
If you're looking for the right place where to put this logic, [provider classes](/docs/extra-topics/package-development#provider-classes) is our recommendation.
238+
If you're looking for the right place where to put this logic, [provider classes](/docs/extra-topics/package-development#provider-classes) is our recommendation.

packages/database/src/Builder/QueryBuilders/QueryBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use function Tempest\Database\inspect;
1010
use function Tempest\Database\query;
1111
use function Tempest\get;
12-
use function Tempest\make;
12+
use function Tempest\Mapper\make;
1313
use function Tempest\Support\arr;
1414

1515
/**

packages/database/src/Builder/QueryBuilders/SelectQueryBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
use Tempest\Support\Str\ImmutableString;
2929

3030
use function Tempest\Database\inspect;
31-
use function Tempest\map;
31+
use function Tempest\Mapper\map;
3232

3333
/**
3434
* @template TModel of object

packages/database/src/Mappers/SelectModelMapper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Tempest\Support\Arr\MutableArray;
1212

1313
use function Tempest\Database\inspect;
14-
use function Tempest\map;
14+
use function Tempest\Mapper\map;
1515
use function Tempest\Support\arr;
1616

1717
#[SkipDiscovery]

packages/http/src/Mappers/PsrRequestToGenericRequestMapper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use Tempest\Support\Arr;
1818
use Throwable;
1919

20-
use function Tempest\map;
20+
use function Tempest\Mapper\map;
2121
use function Tempest\Support\arr;
2222

2323
final readonly class PsrRequestToGenericRequestMapper implements Mapper

packages/http/src/Mappers/RequestToObjectMapper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use Tempest\Reflection\PropertyReflector;
1313
use Tempest\Validation\Validator;
1414

15-
use function Tempest\map;
15+
use function Tempest\Mapper\map;
1616
use function Tempest\Support\arr;
1717

1818
final readonly class RequestToObjectMapper implements Mapper

packages/mail/src/GenericMailer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Symfony\Component\Mailer\Transport\TransportInterface;
66
use Tempest\EventBus\EventBus;
77

8-
use function Tempest\map;
8+
use function Tempest\Mapper\map;
99

1010
/**
1111
* Generic mailer based on Symfony transports.

packages/mail/src/Testing/MailTester.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Tempest\Mail\EmailToSymfonyEmailMapper;
1717
use Tempest\Support\Arr;
1818

19-
use function Tempest\map;
19+
use function Tempest\Mapper\map;
2020
use function Tempest\Support\arr;
2121

2222
final class MailTester

0 commit comments

Comments
 (0)