Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

SymfonyCasts

API Platform 3 Part 3: Custom Resources

via SymfonyCasts

Overview

Thanks to part 1 & part 2, we've already built a seriously powerful API, complete with security, custom fields and many more goodies. In this course, we'll take things even further:

  • State Providers & "proper" custom fields
  • Run custom code on a "state" change (e.g. publishing)
  • Custom (non-entity) DTO #[ApiResource] classes
  • The new stateOptions shortcut for DTO's
  • DTO's & state providers (make:state-provider)
  • State processors with DTO's
  • Data transformation with symfonycasts/micro-mapper
  • IGNORED_ATTRIBUTES, security & other tricks to avoid serialization groups
  • Embedded objects (including non-ApiResource objects)
  • Pagination for DTO resources

Woh. If you thought you were dangerous before with API Platform, just wait...

Syllabus

  • Setup & Ways to Extend API Platform
  • State Providers, Processors & a Custom Field
  • Decorating the Core State Provider
  • Decorating the CollectionProvider
  • Simpler State Processor
  • Running Code "On Publish"
  • Totally Custom Resource
  • Custom Resource State Provider
  • Using a Custom (Date) Identifier
  • Custom Resource Item Provider
  • Custom Resource State Processor
  • Relating Custom ApiResources
  • Embedding Custom DTO's
  • Pagination on a Custom Resource
  • User Class Dto
  • stateOptions + entityClass Magic
  • Entities, DTO's & The "Central" Object
  • Provider: Transforming Entities to DTOs
  • Entity -> DTO Item State Provider
  • DTO -> Entity State Processor
  • Leveraging the Core Processor
  • Controlling Fields without Groups
  • Other Conditional Field Strategies
  • DTO Validation & Security
  • MicroMapper: Central DTO Mapping
  • Reusable Entity->Dto Provider & Processor
  • Quick! Create a DragonTreasure DTO
  • Dtos, Mapping & Max Depth of Relations
  • Making DragonTreasureApi Writable
  • DTO & Security
  • Field Security with Patch
  • Triggering a "Publish"
  • Writable Relation Fields
  • Writing to a Collection Relation
  • Writable Collection via the PropertyAccessor
  • Simpler Validator for Checking State Change

Taught by

Ryan Weaver

Reviews

Start your review of API Platform 3 Part 3: Custom Resources

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.