Skip to content
Development
Skill

/doctrine-transactions

Handle Doctrine transactions (ORM 3 wrapInTransaction), optimistic/pessimistic locking, flush strategies, and transaction boundaries

From plugin
superpowers-symfony
22744 skills14 agents13 commands1 hook

Claude Code

$ npx -y skills add dev-toolings/superpowers-symfony --skill doctrine-transactions --agent claude-code

SKILL.md

doctrine-transactions.SKILL.md
name: doctrine-transactions
description: Handle Doctrine transactions (ORM 3 wrapInTransaction), optimistic/pessimistic locking, flush strategies, and transaction boundaries
capabilities: [read, search, edit, shell]
tags: [doctrine]
# projected by `bun run build` — do not edit by hand
allowed-tools:
  - Read
  - Glob
  - Grep
  - Write
  - Edit
  - Bash

Doctrine Transactions (Symfony)

Use when

  • Several writes must succeed or fail together.
  • Two users or workers can edit the same row concurrently.
  • Deciding where to flush and who owns the transaction boundary.
  • Recovering after a failed flush, a constraint violation, or a lost connection.

Default workflow

1. Place the transaction boundary in the service layer, not in the controller. 2. Group related changes and flush once, inside `wrapInTransaction()`. 3. Pick the concurrency strategy: `#[ORM\Version]` optimistic locking for edits, `PESSIMISTIC_WRITE` for short critical sections. 4. Handle `OptimisticLockException` and constraint violations explicitly. 5. After a rollback, clear the EntityManager and re-fetch what you still need.

Guardrails

  • On ORM 3, `EntityManager::transactional()` is gone: use `wrapInTransaction()`.
  • Outside an explicit transaction each flush commits on its own, so avoid several flushes per operation.
  • Keep transactions and pessimistic locks short; no HTTP calls or mail inside.
  • Do not reuse entities from a failed unit of work.

Progressive disclosure

  • Use this file for execution posture and risk controls.
  • Open references when deep implementation details are needed.

Output contract

  • Transaction boundaries with a single flush per operation.
  • The locking strategy chosen per entity, and how conflicts reach the user.
  • Rollback handling and the state of the EntityManager after it.

References

  • `reference.md`
Read more
@dev-toolings
Ships withsuperpowers-symfony

Superpowers Symfony gives coding agents deep, version-accurate Symfony expertise: from Doctrine schema design and API Platform REST/GraphQL APIs to test-driven development, async Messenger workflows, caching, rate limiting, and clean architecture.

22744 skills14 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
227
Star history of dev-toolings/superpowers-symfony on GitHub, a chart by star-history.com

Other skills on superpowers-symfony.

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills11d309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc12d293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react1d252k
@facebook@facebookInstall Skill

Questions about doctrine-transactions.

Which coding agents can use doctrine-transactions?
doctrine-transactions installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.