Skip to content

Commit 61e8197

Browse files
authored
Merge pull request #1476 from alanpoulain/merge-2.6
2 parents 1df6938 + c815dc8 commit 61e8197

Some content is hidden

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

46 files changed

+741
-531
lines changed

.proselintrc renamed to .proselintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"typography.symbols": false,
44
"typography.exclamation": false,
55
"hyperbole.misc": false,
6-
"cliches.misc": false
6+
"cliches.misc": false,
7+
"lexical_illusions.misc": false
78
}
89
}

admin/file-upload.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,6 @@ export default () => (
3333
```
3434

3535
And that's it!
36-
You don't need to decorate the data provider if you are using the Hydra one: it detects that you have used a `FileInput` and uses a `multipart/form-data` request instead of a JSON-LD one.
36+
The guessers are able to detect that you have used a `FileInput` and are passing this information to the data provider, through a `hasFileField` field in the `extraInformation` object, itself in the data.
37+
If you are using the Hydra data provider, it uses a `multipart/form-data` request instead of a JSON-LD one.
38+
In the case of the `EditGuesser`, the HTTP method used also becomes a `POST` instead of a `PUT`, to prevent a [PHP bug](https://bugs.php.net/bug.php?id=55815).

admin/performance.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use Doctrine\ORM\Mapping as ORM;
2727
/**
2828
* @ORM\Entity
2929
*/
30-
#[ApiResource]
30+
#[ApiResource]
3131
class Author
3232
{
3333
/**

admin/validation.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ use Symfony\Component\Validator\Constraints as Assert;
2020
#[ApiResource]
2121
class Book
2222
{
23-
/**
24-
* @Assert\NotBlank
25-
*/
23+
#[Assert\NotBlank]
2624
public ?string $title = null;
2725
}
2826
```
@@ -54,9 +52,7 @@ use Symfony\Component\Validator\Constraints as Assert;
5452
#[ApiResource]
5553
class Book
5654
{
57-
/**
58-
* @Assert\Isbn
59-
*/
55+
#[Assert\Isbn]
6056
public ?string $isbn = null;
6157
}
6258
```

core/configuration.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ api_platform:
1515
# The version of the API.
1616
version: '0.0.0'
1717

18-
# Return IRIs as Absolute URLs.
19-
# ex: http://example.com/authors/1
20-
absolute_url: false
21-
2218
# Set this to false if you want Webby to disappear.
2319
show_webby: true
2420

core/content-negotiation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ api_platform:
9797
Support for specific formats can also be configured at resource and operation level using the `input_formats` and `output_formats` attributes.
9898
`input_formats` controls the formats accepted in request bodies while `output_formats` controls formats available for responses.
9999

100-
The `format` attribute can be used as a shortcut, it sets both the `input_formats` and `output_formats` in one time.
100+
The `formats` attribute can be used as a shortcut, it sets both the `input_formats` and `output_formats` in one time.
101101

102102
```php
103103
<?php

core/controllers.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -378,12 +378,9 @@ use Symfony\Component\Routing\Annotation\Route;
378378
#[AsController]
379379
class CreateBookPublication extends AbstractController
380380
{
381-
private $bookPublishingHandler;
382-
383-
public function __construct(BookPublishingHandler $bookPublishingHandler)
384-
{
385-
$this->bookPublishingHandler = $bookPublishingHandler;
386-
}
381+
public function __construct(
382+
private BookPublishingHandler $bookPublishingHandler
383+
) {}
387384

388385
#[Route(
389386
name: 'book_post_publication',

core/data-persisters.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ final class BlogPostDataPersister implements ContextAwareDataPersisterInterface
5252

5353
public function persist($data, array $context = [])
5454
{
55-
// call your persistence layer to save $data
56-
return $data;
55+
// call your persistence layer to save $data
56+
return $data;
5757
}
5858

5959
public function remove($data, array $context = [])
6060
{
61-
// call your persistence layer to delete $data
61+
// call your persistence layer to delete $data
6262
}
6363
}
6464
```
@@ -173,13 +173,13 @@ final class BlogPostDataPersister implements ContextAwareDataPersisterInterface,
173173

174174
public function persist($data, array $context = [])
175175
{
176-
// call your persistence layer to save $data
177-
return $data;
176+
// call your persistence layer to save $data
177+
return $data;
178178
}
179179

180180
public function remove($data, array $context = [])
181181
{
182-
// call your persistence layer to delete $data
182+
// call your persistence layer to delete $data
183183
}
184184

185185
// Once called this data persister will resume to the next one
@@ -190,7 +190,7 @@ final class BlogPostDataPersister implements ContextAwareDataPersisterInterface,
190190
}
191191
```
192192

193-
This is very useful when using [`Messenger` with API Platform](messenger.md) as you may want to do something asynchronously with the data but still call the default Doctrine data persister, for example:
193+
This is useful when using [`Messenger` with API Platform](messenger.md) as you may want to do something asynchronously with the data but still call the default Doctrine data persister, for example:
194194

195195
```php
196196
namespace App\DataPersister;

core/data-providers.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ retrieve data for a given resource will be used.
1313

1414
For a given resource, you can implement two kinds of interface:
1515

16-
* the [`CollectionDataProviderInterface`](https://github.com/api-platform/core/blob/main/src/DataProvider/CollectionDataProviderInterface.php)
16+
* the [`CollectionDataProviderInterface`](https://github.com/api-platform/core/blob/main/src/Core/DataProvider/CollectionDataProviderInterface.php)
1717
is used when fetching a collection.
18-
* the [`ItemDataProviderInterface`](https://github.com/api-platform/core/blob/main/src/DataProvider/ItemDataProviderInterface.php)
18+
* the [`ItemDataProviderInterface`](https://github.com/api-platform/core/blob/main/src/Core/DataProvider/ItemDataProviderInterface.php)
1919
is used when fetching items.
2020

2121
Both implementations can also implement a third, optional, interface called
22-
['RestrictedDataProviderInterface'](https://github.com/api-platform/core/blob/main/src/DataProvider/RestrictedDataProviderInterface.php)
22+
['RestrictedDataProviderInterface'](https://github.com/api-platform/core/blob/main/src/Core/DataProvider/RestrictedDataProviderInterface.php)
2323
if you want to limit their effects to a single resource or operation.
2424

2525
In the following examples we will create custom data providers for an entity class called `App\Entity\BlogPost`.
26-
Note, that if your entity is not Doctrine-related, you need to flag the identifier property by using `#[ApiProperty(identifier: true)]` for things to work properly (see also [Entity Identifier Case](serialization.md#entity-identifier-case)).
26+
Note, that if your entity is not Doctrine-related, you need to flag the identifier property by using `#[ApiProperty(identifier: true)` for things to work properly (see also [Entity Identifier Case](serialization.md#entity-identifier-case)).
2727

2828
## Custom Collection Data Provider
2929

@@ -33,9 +33,9 @@ If the [Symfony MakerBundle](https://symfony.com/doc/current/bundles/SymfonyMake
3333
bin/console make:data-provider --collection-only
3434
```
3535

36-
First, your `BlogPostCollectionDataProvider` has to implement the [`CollectionDataProviderInterface`](https://github.com/api-platform/core/blob/main/src/DataProvider/CollectionDataProviderInterface.php):
36+
First, your `BlogPostCollectionDataProvider` has to implement the [`CollectionDataProviderInterface`](https://github.com/api-platform/core/blob/main/src/Core/DataProvider/CollectionDataProviderInterface.php):
3737

38-
The `getCollection` method must return an `array`, a `Traversable` or a [`ApiPlatform\Core\DataProvider\PaginatorInterface`](https://github.com/api-platform/core/blob/main/src/DataProvider/PaginatorInterface.php) instance.
38+
The `getCollection` method must return an `array`, a `Traversable` or a [`ApiPlatform\Core\DataProvider\PaginatorInterface`](https://github.com/api-platform/core/blob/main/src/Core/DataProvider/PaginatorInterface.php) instance.
3939
If no data is available, you should return an empty array.
4040

4141
```php
@@ -91,7 +91,7 @@ If the [Symfony MakerBundle](https://symfony.com/doc/current/bundles/SymfonyMake
9191
bin/console make:data-provider --item-only
9292
```
9393

94-
The process is similar for item data providers. Create a `BlogPostItemDataProvider` implementing the [`ItemDataProviderInterface`](https://github.com/api-platform/core/blob/main/src/DataProvider/ItemDataProviderInterface.php)
94+
The process is similar for item data providers. Create a `BlogPostItemDataProvider` implementing the [`ItemDataProviderInterface`](https://github.com/api-platform/core/blob/main/src/Core/DataProvider/ItemDataProviderInterface.php)
9595
interface:
9696

9797
The `getItem` method can return `null` if no result has been found.

core/default-order.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ namespace App\Entity;
5050
5151
use ApiPlatform\Metadata\ApiResource;
5252
53-
#[ApiResource(order: ['foo' => 'bar'])]
53+
#[ApiResource(order: ['foo', 'bar'])]
5454
class Book
5555
{
5656
// ...
@@ -126,8 +126,8 @@ use ApiPlatform\Metadata\ApiResource;
126126
127127
#[ApiResource]
128128
#[GetCollection]
129-
#[GetCollection(name: 'desc_custom', uriTemplate: 'custom_collection_desc_foos', order: ['name' => 'DESC'])]
130-
#[GetCollection(name: 'asc_custom', uriTemplate: 'custom_collection_asc_foos', order: ['name' => 'ASC'])]
129+
#[GetCollection(name: 'get_desc_custom', uriTemplate: 'custom_collection_desc_foos', order: ['name' => 'DESC'])]
130+
#[GetCollection(name: 'get_asc_custom', uriTemplate: 'custom_collection_asc_foos', order: ['name' => 'ASC'])]
131131
class Book
132132
{
133133
// ...

0 commit comments

Comments
 (0)