SkillsReviewed · dev-toolings

API Platform DTO Resources for Symfony

API Platform DTO Resources is an AI assistant skill for Symfony developers separating API data from database classes, but its examples need version checks and project-specific completion. It guides DTO mapping with Symfony Object Mapper or custom providers and processors, including different input and output shapes for individual API operations.

Researched 15 Nov 2026

In short.

API Platform DTO Resources is an AI assistant skill for Symfony developers designing separate API data structures, but some mapping and write examples are incomplete. It explains declarative Object Mapper configuration, operation-specific input and output classes, and manual provider/processor alternatives. Its strongest value is the concrete decision guidance and version warnings. Compatibility and runtime correctness are not established by the supplied documents, and nothing was executed.

Researched and written by an AI model and checked by a second AI model. How it works

The scope covers both supplied files in content/skills/api-platform-dto-resources: SKILL.md and reference.md, at revision 83522d88f20313c1db6f042a5a49c0e9e0b258b1. The repository-level LICENSE is included as the related notice outside that folder. Other repository skills, build tooling, framework source, dependency licences and application deployments are outside this scope. No code, commands, API operations or tests were executed; runtime behavior and compatibility remain unassessed.

The overview

Identity

The resource is the api-platform-dto-resources skill folder in dev-toolings/superpowers-symfony. SKILL.md supplies assistant instructions and guardrails; reference.md supplies implementation explanations, PHP fragments and validation commands. The original folder is [https://github.com/dev-toolings/superpowers-symfony/tree/main/content/skills/api-platform-dto-resources].

Its subject is treating an API Platform resource class as a data transfer object, or DTO: a class defining the data accepted or returned by the API, separately from the Doctrine entity used for database storage.

Assessment

The skill offers useful direction for an existing Symfony/API Platform project that needs public field names, computed values or operation-specific data structures. Its guardrails identify conditions for automatic mapping and distinguish newer mapping APIs from legacy approaches.

Treat the examples as implementation fragments requiring integration work. They do not supply a complete application or demonstrate successful requests, database writes or framework compatibility. The reference also contains a legacy compatibility inconsistency described under limitations.

Users

The intended users are developers working with an AI coding assistant on Symfony APIs, especially when API fields differ from entity fields, create and update operations need different inputs, or older transformation code needs replacement.

Experienced PHP developers can use the mapping and version notes directly. Beginners will need familiarity with PHP attributes, API Platform operations and Doctrine entities; the resource assumes an existing application and does not teach those foundations.

Capabilities

The instructions cover field renaming, transformation callbacks for computed or formatted values, separate input/output classes, and custom processors for business logic. They explain when to choose automatic Object Mapper integration and when to map explicitly.

The requested deliverables are resource/input/output classes, their mapping bindings, an explanation of the mapping route and tests covering request and response shapes. These are instructions to the assistant; the supplied files do not contain completed application tests or results.

Using it

Requirements

The automatic mapping route assumes an API Platform application using Doctrine ORM and symfony/object-mapper. The reference specifies the component constraint ^7.4|^8.0 and says Object Mapper requires Symfony 7.3 or newer. It frames its examples around API Platform 5.0 on Symfony 7.4 LTS/8.x, with notes for 4.4 and 4.3. These are the resource's compatibility claims, not independently verified results.

The documents direct Symfony 6.4 LTS and API Platform 3.4 users toward manual providers and processors. SKILL.md declares file reading, searching, editing and shell capabilities. A supported assistant host, host installation procedure and complete dependency requirements are not identified.

Mechanism

The documented automatic route connects a DTO resource to its entity through stateOptions with an entityClass. Both classes must carry the required #[Map] bindings. Property attributes describe source fields, target fields and transformation callbacks; operation metadata can select distinct input and output classes.

The reference names ObjectMapperProvider for reads and ObjectMapperInputProcessor/ObjectMapperOutputProcessor for writes. It warns that the older combined ObjectMapperProcessor is removed in API Platform 5.0. For more complex logic, it proposes an explicit ProcessorInterface implementation that calls ObjectMapperInterface::map().

Setup

For the documented automatic route, make the compatible Object Mapper component available, define the DTO resource, configure its entityClass, and complete the mappings on both DTO and entity. Add operation-specific classes where request or response shapes differ. Assistant-specific loading instructions are not supplied.

The reference proposes ./vendor/bin/phpunit --filter=Book, php bin/console api:openapi:export and php bin/console debug:router as validation commands. No Book test implementation accompanies them, and none of these commands was executed.

Example

The Book example maps an entity's title into the API field name and intends to format an integer price in cents as a euro price string. A separate CreateBook input maps name back to title, while BookCollectionItem exposes a smaller collection representation.

A discount endpoint illustrates custom processing: retrieve an entity from the request's read_data attribute, change its price using the submitted percentage, and map it back to Book. The fragment does not demonstrate saving that change to the database or validating the percentage.

Assessment & evidence

Limitations

The automatic route requires mappings on both the entity and DTO, but the first Book example supplies no entity implementation. The separate operation-configuration fragment also omits stateOptions. Neither fragment alone demonstrates the complete automatic configuration described by the guardrails.

The custom-processor section is labelled for API Platform 3.4 and v4, yet its example injects ObjectMapperInterface. Elsewhere, the resource says 3.4 has no Object Mapper. That example therefore does not establish a working legacy implementation; the manual-mapping guidance needs to be followed instead.

The discount fragment assumes a request and loaded entity are available. It shows neither missing-data handling nor database persistence. No executable project, dependency lockfile, completed test suite or runtime results is included, so operational correctness remains unassessed.

Reasoning

The architectural benefit is separating the API's public data contract from the database representation. The demonstrated field renaming and smaller collection output illustrate how those structures can differ without requiring identical entity fields.

This separation adds DTO classes and mappings to maintain. Declarative mapping can reduce explicit conversion code, while custom providers and processors make application-specific behavior explicit. These are architectural tradeoffs inferred from the examples; no performance or productivity measurements are supplied.

Alternatives

The resource presents three implementation choices: a DTO resource with automatic Object Mapper integration, distinct input/output DTOs for individual operations, and custom providers/processors with explicit mapping. The operation-specific classes can be combined with the other approaches.

Its guidance favors manual mapping where Object Mapper is unavailable and custom processing where business logic needs explicit handling. The supplied evidence contains no comparison with other assistant skills or external DTO libraries.

Evidence

The evidence consists of SKILL.md, reference.md and the repository-level LICENSE at revision 83522d88f20313c1db6f042a5a49c0e9e0b258b1. These establish the instructions, examples and licence terms. They do not establish successful installation, working requests or successful persistence. Nothing was executed.

The immutable skill source is [https://raw.githubusercontent.com/dev-toolings/superpowers-symfony/83522d88f20313c1db6f042a5a49c0e9e0b258b1/content/skills/api-platform-dto-resources/SKILL.md]. Its implementation reference is [https://raw.githubusercontent.com/dev-toolings/superpowers-symfony/83522d88f20313c1db6f042a5a49c0e9e0b258b1/content/skills/api-platform-dto-resources/reference.md].

Access & freshness

Costs

No purchase price, subscription, token usage or operating-cost estimate is stated. The MIT notice grants permission free of charge, but that does not establish the cost of an assistant service, implementation work or application infrastructure. Total usage cost is unknown.

Rights

The repository-level MIT licence permits use, copying, modification, distribution, sublicensing and sale, subject to retaining the copyright and permission notices in copies or substantial portions. It disclaims warranties and liability. The captured notice is [https://raw.githubusercontent.com/dev-toolings/superpowers-symfony/83522d88f20313c1db6f042a5a49c0e9e0b258b1/LICENSE].

This notice supports redistribution of the captured skill documents with the notice preserved. Licence terms for framework dependencies or an assistant service are not supplied.

Freshness

The supplied snapshot was captured on 15 November 2026 at revision 83522d88f20313c1db6f042a5a49c0e9e0b258b1. That identifies these source files; it does not establish their last modification date or the current contents of the main branch.

The reference discusses API Platform 5.0, 4.4, 4.3 and legacy 3.4, including APIs it says were removed. The current accuracy of that version guidance is unknown because no independent framework documentation or dependency-resolution results are supplied.

Actions

Before adoption, match the application's installed Symfony and API Platform versions to the proposed mapping route and verify the actual package APIs. Complete the entity-side mappings and operation configuration. For the discount example, establish how the entity is loaded, inputs are validated and database changes are saved.

Add application tests asserting the accepted payloads and returned fields for each relevant operation, then inspect the generated OpenAPI description and routes using the reference's suggested commands. Legacy projects need a manual implementation that does not depend on the incompatible mapper example. No successful integration is established by the supplied material.

Evidence for this report

LICENSEnotice · checked 2026-11-15