Различия

Показаны различия между двумя версиями страницы.

Ссылка на это сравнение

Предыдущая версия справа и слева Предыдущая версия
Следующая версия
Предыдущая версия
php:symfony:операции_operations [2024/04/14 23:58] – [Операции / Operations] mirocowphp:symfony:операции_operations [2024/04/15 21:07] (текущий) – [Операции / Operations] mirocow
Строка 24: Строка 24:
  
 <code php> <code php>
-#[ApiResource(operations:+#[ApiResource( 
-    new Get(), +    shortName: 'User', 
-    new Put(), +    description: 'Utilisateurs', 
-    new Patch(), +    operations: [ 
-    new Delete(), +        new Get(), 
-    new GetCollection(), +        new GetCollection(), 
-    new Post(), +        new Post(), 
-])]+        new Put(), 
 +        new Patch(), 
 +        new Delete(), 
 +    ]
 +    normalizationContext:
 +        'groups' => ['user:read'], 
 +    ], 
 +    denormalizationContext:
 +        'groups' => ['user:write'], 
 +    ], 
 +    security: "is_granted('ROLE_USER')" 
 +)]
 </code> </code>
      
-#[ApiResource] +===== #[ApiResource] ===== 
-ApiPlatform\Metadata\ApiResource вместо ApiPlatform\Core\Annotation\ApiResource+ 
 +2.7 ApiPlatform\Metadata\ApiResource вместо 2.6 ApiPlatform\Core\Annotation\ApiResource
  
 |Перед |После| |Перед |После|
-|-------|-----| +|iri: 'https://schema.org/Book' |types: ['https://schema.org/Book']|
-|iri: |'https://schema.org/Book' |types: ['https://schema.org/Book']|+
 |path: '/books/{id}/publication' |uriTemplate: '/books/{id}/publication' |path: '/books/{id}/publication' |uriTemplate: '/books/{id}/publication'
 |identifiers: [] |uriVariables: []| |identifiers: [] |uriVariables: []|
Строка 45: Строка 56:
 |attributes: ['validation_groups' => ['a', 'b']] |validationContext: ['groups' => ['a', 'b']]| |attributes: ['validation_groups' => ['a', 'b']] |validationContext: ['groups' => ['a', 'b']]|
  
-#[ApiProperty] +===== #[ApiProperty] ===== 
-ApiPlatform\Metadata\ApiProperty вместо ApiPlatform\Core\Annotation\ApiProperty+ 
 +2.7 ApiPlatform\Metadata\ApiProperty вместо 2.6 ApiPlatform\Core\Annotation\ApiProperty
  
 | Перед    | После                   | | Перед    | После                   |
-|----------|-------------------------| 
 | iri:          | 'https://schema.org/Book'    | types: ['https://schema.org/Book']| | iri:          | 'https://schema.org/Book'    | types: ['https://schema.org/Book']|
 | type:         | 'string'                     | builtinTypes: ['string']| | type:         | 'string'                     | builtinTypes: ['string']|
-  + 
 +====== Symfony / API Platform ====== 
 {{topic>[symfony]}} {{topic>[symfony]}}