Тёмный

API Platform Conference 2023 - Ryan Weaver - Create the DTO system of your dreams 

Les-Tilleuls.coop
Подписаться 1,7 тыс.
Просмотров 2,6 тыс.
50% 1

One of the best features of API Platform is the ability to add #[ApiResource] above an entity and… bam! You have a fully-functional API! Though, if you want to have full control and peak clarity, nothing beats creating a dedicated DTO class.
But, creating a DTO class - especially when the data comes from Doctrine - feelslike reinventing the wheel! Suddenly you need to create a state provider, stateprocessor and filters… which all do the same thing that API Platform does automatically for entities.
No more! In this talk, we’ll explore a new feature called “state options” that gives you the flexibility of a DTO class, but the convenience of an entity. We’ll explore how this works & exactly what you need (e.g. a mapper system) to create a DTO class and have it “just work”.
_________
More info: api-platform.com/con/2023/
X/Twitter: / apiplatform
Music credits: Solar Flare, Adi Goldstein

Наука

Опубликовано:

 

9 ноя 2023

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 3   
@techjunky9863
@techjunky9863 12 часов назад
So do you put now the security annotations on the DTO in this case or still the entity cause this is what the Provider/Processor is calling?
@ZJIoDeu
@ZJIoDeu 7 месяцев назад
We did something quite similar in our project with API Platform 3 and the development process was very painful. Hopefully, we succeed with DTO / processor approach but it took much time to understand how it works with a lack of documentation. One of the weirdest things was that we had to expose entity resource and output DTO for this entity as a resource too (GET item only) to make it work. Then, to create the one resource from those two (dto and entity) you have to use the same shortName and uriTemplate to fix openapi schema I didn`t try stateOptions and it might solve this issue. But in general, it is very far from DTO system of "my dreams" :)
@clementtalleu2534
@clementtalleu2534 7 месяцев назад
Aussi passionnant que les sf casts !
Далее
Strawberry Cat?! 🙀 #cat #cute #catlover
00:42
Просмотров 4,9 млн
3M❤️ #thankyou #shorts
00:14
Просмотров 5 млн
skibidi toilet 76 (part1)
03:10
Просмотров 11 млн
Есть ли массивы в PHP?
37:41
Просмотров 4,6 тыс.
🕷️ You only Scrape Once
52:25
Просмотров 167
Symfony is RAD - Rick Kuipers
57:08
Просмотров 2,7 тыс.
🛑 STOP! SAMSUNG НЕ ПОКУПАТЬ!
1:00
Просмотров 352 тыс.
Acer Predator Тараканьи Бега!
1:00
Просмотров 155 тыс.