1
Vistas
Manuel Aranda Rosales edited this page 2024-08-02 10:26:50 +02:00
Documentación - API ogCore
Select Language / Seleccionar Idioma
English
Table of Contents
Introduction
This documentation describes the configuration of API Platform in a Symfony project. It details the resources, operations, and entity properties exposed through the API.
Configuration
API configuration is done in Symfony configuration files, usually in the config/packages/api_platform.yaml
file.
resources:
App\Entity\View:
processor: App\State\Processor\ViewProcessor
input: App\Dto\Input\ViewInput
output: App\Dto\Output\ViewOutput
normalizationContext:
groups: ['default', 'view:read']
denormalizationContext:
groups: ['view:write']
operations:
ApiPlatform\Metadata\GetCollection:
provider: App\State\Provider\ViewProvider
filters:
- 'api_platform.filter.view.order'
- 'api_platform.filter.view.search'
ApiPlatform\Metadata\Get:
provider: App\State\Provider\ViewProvider
ApiPlatform\Metadata\Put:
provider: App\State\Provider\ViewProvider
ApiPlatform\Metadata\Patch:
provider: App\State\Provider\ViewProvider
ApiPlatform\Metadata\Post: ~
ApiPlatform\Metadata\Delete: ~
properties:
App\Entity\View:
id:
identifier: false
uuid:
identifier: true
Resource Definition
App\Entity\View
- Processor:
App\State\Processor\ViewProcessor
- Input:
App\Dto\Input\ViewInput
- Output:
App\Dto\Output\ViewOutput
- Normalization Context:
['default', 'view:read']
- Denormalization Context:
['view:write']
API Operations
View Operations
Get View Collection (GetCollection)
- Provider:
App\State\Provider\ViewProvider
- Filters:
- Order views:
api_platform.filter.view.order
- Search views:
api_platform.filter.view.search
- Order views:
Get View (Get)
- Provider:
App\State\Provider\ViewProvider
Update View (Put)
- Provider:
App\State\Provider\ViewProvider
Partially Update View (Patch)
- Provider:
App\State\Provider\ViewProvider
Create View (Post)
- Default Operation: ~
Delete View (Delete)
- Default Operation: ~
Entity Properties
App\Entity\View
-
id:
- Identifier:
false
- Identifier:
-
uuid:
- Identifier:
true
- Identifier:
View Input DTO
Fields Required in View Endpoint Input
-
name
- Type: string
- Validation: Not blank
- Groups:
view:write
-
description
- Type: string
- Validation: Optional
- Groups:
view:write
-
isActive
- Type: boolean
- Validation: Not null
- Groups:
view:write
- Default: false
Español
Índice
- Introducción
- Configuración
- Definición de Recursos
- Operaciones de API
- Propiedades de la Entidad
- DTO de Entrada de Vista
Introducción
Esta documentación describe la configuración de API Platform en un proyecto Symfony. Se detallan los recursos, operaciones y propiedades de las entidades expuestas a través de la API.
Configuración
La configuración de la API se realiza en los archivos de configuración de Symfony, generalmente en config/packages/api_platform.yaml
.
resources:
App\Entity\View:
processor: App\State\Processor\ViewProcessor
input: App\Dto\Input\ViewInput
output: App\Dto\Output\ViewOutput
normalizationContext:
groups: ['default', 'view:read']
denormalizationContext:
groups: ['view:write']
operations:
ApiPlatform\Metadata\GetCollection:
provider: App\State\Provider\ViewProvider
filters:
- 'api_platform.filter.view.order'
- 'api_platform.filter.view.search'
ApiPlatform\Metadata\Get:
provider: App\State\Provider\ViewProvider
ApiPlatform\Metadata\Put:
provider: App\State\Provider\ViewProvider
ApiPlatform\Metadata\Patch:
provider: App\State\Provider\ViewProvider
ApiPlatform\Metadata\Post: ~
ApiPlatform\Metadata\Delete: ~
properties:
App\Entity\View:
id:
identifier: false
uuid:
identifier: true
Definición de Recursos
App\Entity\View
- Processor:
App\State\Processor\ViewProcessor
- Input:
App\Dto\Input\ViewInput
- Output:
App\Dto\Output\ViewOutput
- Contexto de Normalización:
['default', 'view:read']
- Contexto de Desnormalización:
['view:write']
Operaciones de API
Operaciones de Vista
Obtener Colección de Vistas (GetCollection)
- Provider:
App\State\Provider\ViewProvider
- Filtros:
- Ordenar vistas:
api_platform.filter.view.order
- Buscar vistas:
api_platform.filter.view.search
- Ordenar vistas:
Obtener Vista (Get)
- Provider:
App\State\Provider\ViewProvider
Actualizar Vista (Put)
- Provider:
App\State\Provider\ViewProvider
Actualización Parcial de Vista (Patch)
- Provider:
App\State\Provider\ViewProvider
Crear Vista (Post)
- Operación Predeterminada: ~
Eliminar Vista (Delete)
- Operación Predeterminada: ~
Propiedades de la Entidad
App\Entity\View
-
id:
- Identificador:
false
- Identificador:
-
uuid:
- Identificador:
true
- Identificador:
DTO de Entrada de Vista
Campos Requeridos en la Entrada del Endpoint de Vista
-
name
- Tipo: string
- Validación: No nulo
- Groups:
view:write
-
description
- Tipo: string
- Validación: Opcional
- Groups:
view:write
-
isActive
- Tipo: booleano
- Validación: No nulo
- Groups:
view:write
- Predeterminado: false
Table of Contents
- Select Language / Seleccionar Idioma
- English
- Table of Contents
- Introduction
- Configuration
- Resource Definition
- API Operations
- Entity Properties
- View Input DTO
- Español