Skip to content

docs: remove ApiPlatform\Core occurrences #1575

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions admin/handling-relations.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ For instance, if your API returns:
"hydra:member": [
{
"@id": "/books/07b90597-542e-480b-a6bf-5db223c761aa",
"@type": "http://schema.org/Book",
"@type": "https://schema.org/Book",
"title": "War and Peace",
"author": {
"@id": "/authors/d7a133c1-689f-4083-8cfc-afa6d867f37d",
"@type": "http://schema.org/Author",
"@type": "https://schema.org/Author",
"firstName": "Leo",
"lastName": "Tolstoi"
}
Expand Down
2 changes: 1 addition & 1 deletion admin/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ You can **customize everything** by using provided React Admin and [MUI](https:/
* Automatically generates an admin interface for all the resources of the API thanks to the hypermedia features of Hydra or to the OpenAPI documentation
* Generates 'list', 'create', 'show', and 'edit' screens, as well as a delete button
* Generates suitable inputs and fields according to the API doc (e.g. number HTML input for numbers, checkbox for booleans, selectbox for relationships...)
* Generates suitable inputs and fields according to Schema.org types if available (e.g. email field for `http://schema.org/email`)
* Generates suitable inputs and fields according to Schema.org types if available (e.g. email field for `https://schema.org/email`)
* Handles relationships
* Supports pagination
* Supports filters and ordering
Expand Down
10 changes: 5 additions & 5 deletions admin/schema.org.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ The following examples will use [API Platform Core](../core/) to create such API
By default, IRIs of related objects are displayed in lists and forms.
However, it is often more user-friendly to display a string representation of the resource (such as its name) instead of its ID.

To configure which property should be shown to represent your entity, map the property containing the name of the object with the `http://schema.org/name` type:
To configure which property should be shown to represent your entity, map the property containing the name of the object with the `https://schema.org/name` type:

```php
// api/src/Entity/Person.php
...

#[ApiProperty(types: ["http://schema.org/name"])]
#[ApiProperty(types: ["https://schema.org/name"])]
private $name;

...
Expand All @@ -30,8 +30,8 @@ Besides, it is also possible to use the documentation to customize some fields a

The following Schema.org types are currently supported by API Platform Admin:

* `http://schema.org/email`: the field will be rendered using the `<EmailField>` React Admin component
* `http://schema.org/url`: the field will be rendered using the `<UrlField>` React Admin component
* `http://schema.org/identifier`: the field will be formatted properly in inputs
* `https://schema.org/email`: the field will be rendered using the `<EmailField>` React Admin component
* `https://schema.org/url`: the field will be rendered using the `<UrlField>` React Admin component
* `https://schema.org/identifier`: the field will be formatted properly in inputs

Note: if you already use validation on your properties, the semantics are already configured correctly (see [the correspondence table](../core/validation.md#open-vocabulary-generated-from-validation-metadata))!
6 changes: 3 additions & 3 deletions core/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,9 @@ api_platform:
Symfony\Component\Serializer\Exception\ExceptionInterface: 400

# Or with a constant defined in the 'Symfony\Component\HttpFoundation\Response' class.
ApiPlatform\Core\Exception\InvalidArgumentException: !php/const Symfony\Component\HttpFoundation\Response::HTTP_BAD_REQUEST
ApiPlatform\Exception\InvalidArgumentException: !php/const Symfony\Component\HttpFoundation\Response::HTTP_BAD_REQUEST

ApiPlatform\Core\Exception\FilterValidationException: 400
ApiPlatform\Exception\FilterValidationException: 400

Doctrine\ORM\OptimisticLockException: 409

Expand Down Expand Up @@ -371,7 +371,7 @@ api_platform:
stateless: ~

# The URL generation strategy to use for IRIs
url_generation_strategy: !php/const ApiPlatform\Core\Api\UrlGeneratorInterface::ABS_PATH
url_generation_strategy: !php/const ApiPlatform\Api\UrlGeneratorInterface::ABS_PATH

# ...
```
4 changes: 2 additions & 2 deletions core/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Attribute | Type | Default | Description

Registering your own event listeners to add extra logic is convenient.

The [`ApiPlatform\Core\EventListener\EventPriorities`](https://github.com/api-platform/core/blob/main/src/Symfony/EventListener/EventPriorities.php) class comes with a convenient set of class constants corresponding to commonly used priorities:
The [`ApiPlatform\Symfony\EventListener\EventPriorities`](https://github.com/api-platform/core/blob/main/src/Symfony/EventListener/EventPriorities.php) class comes with a convenient set of class constants corresponding to commonly used priorities:

Constant | Event | Priority |
-------------------|-------------------|----------|
Expand All @@ -86,7 +86,7 @@ In the following example, we will send a mail each time a new book is created us

namespace App\EventSubscriber;

use ApiPlatform\Core\EventListener\EventPriorities;
use ApiPlatform\Symfony\EventListener\EventPriorities;
use App\Entity\Book;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\Request;
Expand Down
4 changes: 2 additions & 2 deletions core/extending-jsonld-context.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ namespace App\Entity;
use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\ApiResource;

#[ApiResource(types: ['http://schema.org/Book'])]
#[ApiResource(types: ['https://schema.org/Book'])]
class Book
{
// ...

#[ApiProperty(
types: ['http://schema.org/name'],
types: ['https://schema.org/name'],
jsonldContext: [
'@id' => 'http://yourcustomid.com',
'@type' => 'http://www.w3.org/2001/XMLSchema#string',
Expand Down
2 changes: 1 addition & 1 deletion core/extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Extensions are specific to Doctrine and Elasticsearch-PHP, and therefore, the Do
reading support must be enabled to use this feature. If you use custom providers it's up to you to implement your own
extension system or not.

You can find a working example of a custom data provider using a pagination extension in the [API Platform's demo application](https://github.com/api-platform/demo/blob/master/api/src/DataProvider/Extension/TopBookPaginationExtension.php).
You can find a working example of a custom extension using a pagination in the [API Platform's demo application](https://github.com/api-platform/demo/blob/main/api/src/State/Extension/TopBookPaginationExtension.php).

## Custom Doctrine ORM Extension

Expand Down
32 changes: 16 additions & 16 deletions core/external-vocabularies.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ namespace App\Entity;
use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\ApiResource;

#[ApiResource(types: ['http://schema.org/Book'])]
#[ApiResource(types: ['https://schema.org/Book'])]
class Book
{
// ...

#[ApiProperty(types: ['http://schema.org/name'])]
#[ApiProperty(types: ['https://schema.org/name'])]
public $name;

// ...
Expand Down Expand Up @@ -57,17 +57,17 @@ Built-in mapping is:

Constraints | Schema.org type |
---------------------------------------------------- |-----------------------------------|
`Symfony\Component\Validator\Constraints\Url` | `http://schema.org/url` |
`Symfony\Component\Validator\Constraints\Email` | `http://schema.org/email` |
`Symfony\Component\Validator\Constraints\Uuid` | `http://schema.org/identifier` |
`Symfony\Component\Validator\Constraints\CardScheme` | `http://schema.org/identifier` |
`Symfony\Component\Validator\Constraints\Bic` | `http://schema.org/identifier` |
`Symfony\Component\Validator\Constraints\Iban` | `http://schema.org/identifier` |
`Symfony\Component\Validator\Constraints\Date` | `http://schema.org/Date` |
`Symfony\Component\Validator\Constraints\DateTime` | `http://schema.org/DateTime` |
`Symfony\Component\Validator\Constraints\Time` | `http://schema.org/Time` |
`Symfony\Component\Validator\Constraints\Image` | `http://schema.org/image` |
`Symfony\Component\Validator\Constraints\File` | `http://schema.org/MediaObject` |
`Symfony\Component\Validator\Constraints\Currency` | `http://schema.org/priceCurrency` |
`Symfony\Component\Validator\Constraints\Isbn` | `http://schema.org/isbn` |
`Symfony\Component\Validator\Constraints\Issn` | `http://schema.org/issn` |
`Symfony\Component\Validator\Constraints\Url` | `https://schema.org/url` |
`Symfony\Component\Validator\Constraints\Email` | `https://schema.org/email` |
`Symfony\Component\Validator\Constraints\Uuid` | `https://schema.org/identifier` |
`Symfony\Component\Validator\Constraints\CardScheme` | `https://schema.org/identifier` |
`Symfony\Component\Validator\Constraints\Bic` | `https://schema.org/identifier` |
`Symfony\Component\Validator\Constraints\Iban` | `https://schema.org/identifier` |
`Symfony\Component\Validator\Constraints\Date` | `https://schema.org/Date` |
`Symfony\Component\Validator\Constraints\DateTime` | `https://schema.org/DateTime` |
`Symfony\Component\Validator\Constraints\Time` | `https://schema.org/Time` |
`Symfony\Component\Validator\Constraints\Image` | `https://schema.org/image` |
`Symfony\Component\Validator\Constraints\File` | `https://schema.org/MediaObject` |
`Symfony\Component\Validator\Constraints\Currency` | `https://schema.org/priceCurrency` |
`Symfony\Component\Validator\Constraints\Isbn` | `https://schema.org/isbn` |
`Symfony\Component\Validator\Constraints\Issn` | `https://schema.org/issn` |
14 changes: 7 additions & 7 deletions core/file-upload.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ use Vich\UploaderBundle\Mapping\Annotation as Vich;
#[ORM\Entity]
#[ApiResource(
normalizationContext: ['groups' => ['media_object:read']],
types: ['http://schema.org/MediaObject'],
types: ['https://schema.org/MediaObject'],
operations: [
new Get(),
new GetCollection(),
Expand Down Expand Up @@ -105,7 +105,7 @@ class MediaObject
#[ORM\Id, ORM\Column, ORM\GeneratedValue]
private ?int $id = null;

#[ApiProperty(types: ['http://schema.org/contentUrl'])]
#[ApiProperty(types: ['https://schema.org/contentUrl'])]
#[Groups(['media_object:read'])]
public ?string $contentUrl = null;

Expand Down Expand Up @@ -218,7 +218,7 @@ your data, you will get a response looking like this:

```json
{
"@type": "http://schema.org/MediaObject",
"@type": "https://schema.org/MediaObject",
"@id": "/media_objects/<id>",
"contentUrl": "<url>"
}
Expand Down Expand Up @@ -257,14 +257,14 @@ use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;

#[ORM\Entity]
#[ApiResource(types: ['http://schema.org/Book'])]
#[ApiResource(types: ['https://schema.org/Book'])]
class Book
{
// ...

#[ORM\ManyToOne(targetEntity: MediaObject::class)]
#[ORM\JoinColumn(nullable: true)]
#[ApiProperty(types: ['http://schema.org/image'])]
#[ApiProperty(types: ['https://schema.org/image'])]
public ?MediaObject $image = null;

// ...
Expand Down Expand Up @@ -363,7 +363,7 @@ use Vich\UploaderBundle\Mapping\Annotation as Vich;
#[ApiResource(
normalizationContext: ['groups' => ['book:read']],
denormalizationContext: ['groups' => ['book:write']],
types: ['http://schema.org/Book'],
types: ['https://schema.org/Book'],
operations: [
new GetCollection(),
new Post(inputFormats: ['multipart' => ['multipart/form-data']])
Expand All @@ -373,7 +373,7 @@ class Book
{
// ...

#[ApiProperty(types: ['http://schema.org/contentUrl'])]
#[ApiProperty(types: ['https://schema.org/contentUrl'])]
#[Groups(['book:read'])]
public ?string $contentUrl = null;

Expand Down
6 changes: 3 additions & 3 deletions core/form-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ This decorator is able to denormalize posted form data to the target object. In

namespace App\EventListener;

use ApiPlatform\Core\Util\RequestAttributesExtractor;
use ApiPlatform\Serializer\SerializerContextBuilderInterface;
use ApiPlatform\Symfony\EventListener\DeserializeListener as DecoratedListener;
use ApiPlatform\Util\RequestAttributesExtractor;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use ApiPlatform\Core\EventListener\DeserializeListener as DecoratedListener;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
use ApiPlatform\Core\Serializer\SerializerContextBuilderInterface;

final class DeserializeListener
{
Expand Down
6 changes: 3 additions & 3 deletions core/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ use Symfony\Component\Validator\Constraints as Assert;
*
*/
#[ORM\Entity]
#[ApiResource(types: ['http://schema.org/Offer'])]
#[ApiResource(types: ['https://schema.org/Offer'])]
class Offer
{
#[ORM\Id, ORM\Column, ORM\GeneratedValue]
Expand Down Expand Up @@ -173,7 +173,7 @@ resources:
App\Entity\Offer:
shortName: 'Offer' # optional
description: 'An offer from my shop' # optional
types: ['http://schema.org/Offer'] # optional
types: ['https://schema.org/Offer'] # optional
paginationItemsPerPage: 25 # optional
```

Expand All @@ -192,7 +192,7 @@ resources:
description="An offer from my shop" <!-- optional -->
>
<types>
<type>http://schema.org/Offer</type> <!-- optional -->
<type>https://schema.org/Offer</type> <!-- optional -->
</types>
</resource>
</resources>
Expand Down
4 changes: 2 additions & 2 deletions core/graphql.md
Original file line number Diff line number Diff line change
Expand Up @@ -1977,7 +1977,7 @@ use Vich\UploaderBundle\Mapping\Annotation as Vich;
#[ORM\Entity]
#[ApiResource(
normalizationContext: ['groups' => ['media_object_read']],
types: ['http://schema.org/MediaObject'],
types: ['https://schema.org/MediaObject'],
graphQlOperations: [
new Mutation(
name: 'upload',
Expand All @@ -1997,7 +1997,7 @@ class MediaObject
#[ORM\Id, ORM\Column, ORM\GeneratedValue]
protected ?int $id = null;

#[ApiProperty(types: ['http://schema.org/contentUrl'])]
#[ApiProperty(types: ['https://schema.org/contentUrl'])]
#[Groups(['media_object_read'])]
public ?string $contentUrl = null;

Expand Down
8 changes: 4 additions & 4 deletions core/jwt.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ To do it, we need to create a decorator:

namespace App\OpenApi;

use ApiPlatform\Core\OpenApi\Factory\OpenApiFactoryInterface;
use ApiPlatform\Core\OpenApi\OpenApi;
use ApiPlatform\Core\OpenApi\Model;
use ApiPlatform\OpenApi\Factory\OpenApiFactoryInterface;
use ApiPlatform\OpenApi\OpenApi;
use ApiPlatform\OpenApi\Model;

final class JwtDecorator implements OpenApiFactoryInterface
{
Expand Down Expand Up @@ -302,7 +302,7 @@ To test your authentication with `ApiTestCase`, you can write a method as below:

namespace App\Tests;

use ApiPlatform\Core\Bridge\Symfony\Bundle\Test\ApiTestCase;
use ApiPlatform\Symfony\Bundle\Test\ApiTestCase;
use App\Entity\User;
use Hautelook\AliceBundle\PhpUnit\ReloadDatabaseTrait;

Expand Down
2 changes: 1 addition & 1 deletion core/messenger.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ We use the `status` attribute to configure API Platform to return a [202 Accepte
It indicates that the request has been received and will be treated later, without giving an immediate return to the client.
Finally, the `output` attribute is set to `false`, so the HTTP response that will be generated by API Platform will be empty, and the [serialization process](serialization.md) will be skipped.

**Note:** when using `messenger=true` ApiResource attribute in a Doctrine entity, the Doctrine DataPersister is not called. If you want the Doctrine DataPersister to be called, you should implement a `ResumableDataPersisterInterface` [documented here](data-persisters.md).
**Note:** when using `messenger=true` ApiResource attribute in a Doctrine entity, the Doctrine Processor is not called. If you want the Doctrine Processor to be called, you should [decorate a built-in state processor](state-processors.md#decorating-the-built-in-state-processors) and implement your own logic.

## Registering a Message Handler

Expand Down
2 changes: 1 addition & 1 deletion core/mongodb.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ use Symfony\Component\Validator\Constraints as Assert;
/**
* @ODM\Document
*/
#[ApiResource(types: ['http://schema.org/Offer'])]
#[ApiResource(types: ['https://schema.org/Offer'])]
class Offer
{
/**
Expand Down
4 changes: 2 additions & 2 deletions core/operation-path-naming.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ Let's assume we need URLs without separators (e.g. `api.tld/myresources`)

### Defining the Operation Segment Name Generator

Make sure the custom segment generator implements [`ApiPlatform\Core\Operation\PathSegmentNameGeneratorInterface`](https://github.com/api-platform/core/blob/main/src/Operation/PathSegmentNameGeneratorInterface.php):
Make sure the custom segment generator implements [`ApiPlatform\Operation\PathSegmentNameGeneratorInterface`](https://github.com/api-platform/core/blob/main/src/Operation/PathSegmentNameGeneratorInterface.php):

```php
<?php
// api/src/Operation/SingularPathSegmentNameGenerator.php
namespace App\Operation;

use ApiPlatform\Core\Operation\PathSegmentNameGeneratorInterface;
use ApiPlatform\Operation\PathSegmentNameGeneratorInterface;

class SingularPathSegmentNameGenerator implements PathSegmentNameGeneratorInterface
{
Expand Down
2 changes: 1 addition & 1 deletion core/pagination.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ is returned. It's a valid JSON(-LD) document containing items of the requested p
"hydra:member": [
{
"@id": "/books/1",
"@type": "http://schema.org/Book",
"@type": "https://schema.org/Book",
"name": "My awesome book"
},
{
Expand Down
6 changes: 3 additions & 3 deletions core/serialization.md
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ In the above example, you will receive the book's data like this:
{
"@context": "/contexts/Book",
"@id": "/books/3",
"@type": "http://schema.org/Book",
"@type": "https://schema.org/Book",
"publicationDate": "1989-06-16"
}
```
Expand Down Expand Up @@ -1074,8 +1074,8 @@ The JSON output will now include the embedded context:
"@context": {
"@vocab": "http://localhost:8000/apidoc#",
"hydra": "http://www.w3.org/ns/hydra/core#",
"name": "http://schema.org/name",
"author": "http://schema.org/author"
"name": "https://schema.org/name",
"author": "https://schema.org/author"
},
"@id": "/books/62",
"@type": "Book",
Expand Down
Loading