In short.
Doctrine Fetch Modes is an AI coding assistant skill for Symfony developers improving database reads, but its version-sensitive examples need validation in each project. It recommends diagnosing excess queries with the Symfony profiler, choosing relation loading per repository method and using data transfer objects for read-only lists. The reference targets Doctrine ORM 3 and DBAL 4 and identifies migration concerns. No code or commands were executed; correctness, compatibility and performance were not tested.
Researched and written by an AI model and checked by a second AI model. How it works
Coverage includes both files in content/skills/doctrine-fetch-modes, SKILL.md and reference.md, plus the repository-level LICENSE at commit 83522d88f20313c1db6f042a5a49c0e9e0b258b1. Other repository content, assistant-host documentation, upstream Doctrine documentation and the referenced batch-processing skill are outside the supplied evidence. No installation, code execution, query profiling, compatibility test or performance measurement was performed.
The overview
Identity
The doctrine-fetch-modes folder in dev-toolings/superpowers-symfony contains SKILL.md, the assistant instruction entry point, and reference.md, its implementation reference. The original resource location is [https://github.com/dev-toolings/superpowers-symfony/tree/main/content/skills/doctrine-fetch-modes].
The skill focuses on Doctrine relation loading and read queries in Symfony applications. Its declared capabilities include reading, searching, editing and shell access.
Assessment
The material offers a concrete decision sequence: establish the query problem, load needed relations explicitly, and select only the data required for read-only screens. Repository methods and DTO examples make the advice actionable for developers already working with Doctrine.
Its requested before-and-after query counts are an output requirement, not supplied results. The evidence establishes useful instructional content, but does not establish a speedup, memory reduction or successful assistant integration.
Users
The skill suits Symfony developers investigating N+1 queries, where accessing related data during a loop can trigger additional database queries. It also addresses read-only lists that load unnecessarily complete entities and projects migrating older Doctrine code.
Beginners will need basic familiarity with entities, relationships and repositories. Experienced developers get focused examples for DTO projection, query hints, indexed results and DBAL access.
Capabilities
The instructions cover LAZY, EAGER and EXTRA_LAZY relation loading; fetch joins using addSelect() and leftJoin(); and SELECT NEW projections into data transfer objects, or DTOs. DTOs hold explicitly selected values without becoming managed Doctrine entities.
The reference also demonstrates proxy initialization checks, read-only and refresh query hints, ID-indexed result arrays and DBAL 4 methods including fetchAllAssociative(), fetchOne(), executeQuery() and executeStatement(). These are documented techniques, with no supplied execution results.
Using it
Requirements
The reference names Doctrine ORM 3.x and DBAL 4.x as its target and includes migration notes for ORM 2.x. The examples assume a Symfony application with Doctrine entities and repositories. Exact minimum PHP and Symfony versions are unspecified; the DTO example uses constructor property promotion and readonly properties.
SKILL.md lists Read, Glob, Grep, Write, Edit and Bash as allowed tools. Supported assistant hosts, required models and host-specific permission behavior are not documented.
Mechanism
The skill directs an assistant to confirm excess queries in the Symfony profiler before changing mappings. It favors lazy relations by default, EXTRA_LAZY operations for large collections, and explicit repository fetch joins for relations needed by a particular use case.
For read-only lists, SELECT NEW constructs DTOs from selected fields, with constructor arguments matching the projection order. Separate examples use a read-only query hint to skip change tracking and an index-by alias to organize results by ID.
Setup
Retain SKILL.md and reference.md together: the entry file explicitly points to its companion for implementation details. The supplied folder does not document an assistant-specific installation path, installer or activation procedure.
Before applying its examples, establish the application's Doctrine versions, relevant relationships and current query behavior. The reference supplies validation commands, but no completed setup or validation output.
Example
For a posts list displaying author names, the reference contrasts findAll() followed by getAuthor()->getName() in a loop with a query using addSelect('a') and leftJoin('p.author', 'a'). The intended result is to load authors with the posts and avoid subsequent relation queries; actual query counts are unknown.
For a read-only list, another example projects p.id, p.title and a.name into App\Dto\PostListItem through SELECT NEW. The constructor accepts those values in the same order, and the returned objects are DTOs rather than managed entities.
Assessment & evidence
Limitations
The entry file broadly says PARTIAL fails in ORM 3.0 through 3.2, while the reference adds an exception for array hydration in 3.2. These statements need attention to the exact version and hydration mode; the resource consistently recommends SELECT NEW for read-only lists.
A broad fetch-join example selects author, tags and comments together without discussing result-size or pagination trade-offs. The EAGER example describes same-query loading without supplying SQL output. Those examples do not establish the behavior or suitability of a particular application query.
Reasoning
The design places relation-loading decisions in repository queries so each use case can specify the data it needs. Its preference for DTOs makes read-only projections explicit and avoids relying on partially populated managed entities.
Starting with profiler evidence is a useful part of this approach because the proposed change can then address an observed query problem. Whether any particular change improves performance remains unknown until measured.
Alternatives
Within the documented approaches, lazy loading defers relation access, fetch joins explicitly load selected relations, EXTRA_LAZY supports targeted collection operations, and DTO projection supplies selected fields for display. DBAL methods provide a raw-SQL route for reports and projections.
For large-volume iteration and memory management, the reference points to a separate doctrine-batch-processing skill. That skill's contents are not supplied, so its coverage and suitability are unknown.
Evidence
The evidence consists of the complete supplied SKILL.md, reference.md and repository LICENSE. It contains instructions, code examples and suggested validation commands, with no profiler captures, benchmarks or test outputs.
The original entry file is [https://raw.githubusercontent.com/dev-toolings/superpowers-symfony/83522d88f20313c1db6f042a5a49c0e9e0b258b1/content/skills/doctrine-fetch-modes/SKILL.md]. The companion reference is [https://raw.githubusercontent.com/dev-toolings/superpowers-symfony/83522d88f20313c1db6f042a5a49c0e9e0b258b1/content/skills/doctrine-fetch-modes/reference.md]. Runtime behavior and assistant integration are not assessed.
Access & freshness
Costs
No pricing, subscription requirement or AI usage estimate is supplied. Acquisition charges, assistant usage charges and project database or infrastructure costs are unknown. No measured cost savings are provided.
Rights
The supplied repository-level MIT license permits use, copying, modification, distribution, sublicensing and sale of the software and associated documentation. Copies or substantial portions must retain the copyright and permission notices. The material is supplied without warranty.
The captured notice is available at [https://raw.githubusercontent.com/dev-toolings/superpowers-symfony/83522d88f20313c1db6f042a5a49c0e9e0b258b1/LICENSE]. No separate skill-specific license notice is supplied.
Freshness
The supplied snapshot was captured on 17 November 2026 at 05:26:43 UTC and is pinned to commit 83522d88f20313c1db6f042a5a49c0e9e0b258b1. Its stated compatibility target is ORM 3.x and DBAL 4.x.
The files provide no resource release number or release date. Changes after the captured commit and compatibility outside the documented target are unknown.
Actions
Identify the installed Doctrine versions and record profiler query counts for the affected endpoint. Choose a fetch join when related entities are needed, or a DTO projection when the screen only needs selected values. Recheck the real endpoint after the change.
The reference suggests php bin/console doctrine:query:dql "<DQL>" --show-sql, php bin/console doctrine:schema:validate and ./vendor/bin/phpunit --filter=Repository. These commands were not run. SQL inspection and repository checks should accompany actual before-and-after query measurements.
