Операции / Operations

<?php // api/src/Entity/Book.php namespace App\Entity; use ApiPlatform\Metadata\ApiResource; use ApiPlatform\Metadata\Get; use ApiPlatform\Metadata\Post; use App\Controller\CreateBookPublication; #[ApiResource(types: ['https://schema.org/Book'], operations: [ new Get(), new Post(name: 'publication', uriTemplate: '/books/{id}/publication') ])] class Book { // ... }
#[ApiResource(operations: [ new Get(), new Put(), new Patch(), new Delete(), new GetCollection(), new Post(), ])]

#[ApiResource] ApiPlatform\Metadata\ApiResource вместо ApiPlatform\Core\Annotation\ApiResource

Перед	После
——-	—–
iri:	'https://schema.org/Book'	types: ['https://schema.org/Book']
path: '/books/{id}/publication'
identifiers: []	uriVariables: []
attributes: []	extraProperties: []
attributes: ['validation_groups' ⇒ ['a', 'b']]	validationContext: ['groups' ⇒ ['a', 'b']]

#[ApiProperty] ApiPlatform\Metadata\ApiProperty вместо ApiPlatform\Core\Annotation\ApiProperty

Перед	После
———-	————————-
iri:	'https://schema.org/Book'	types: ['https://schema.org/Book']
type:	'string'	builtinTypes: ['string']