Symfony: preserve requirements through advanced agent edits
Work through PHP examples of real application boundaries: Keep Symfony object authorization before the order write; Keep Symfony inventory and order writes on one Doctrine transaction. Each recipe includes implementation code, integration prerequisites, failure-path tests to add, a Perch rule, and the captured broken/fixed source checks.
Download the Symfony rule pack ZIP · Inspect the YAML rules
PHP
A firewall establishes the signed-in user. A voter establishes whether that user may act on this particular order. Keep the object check inside the controller action because a route-level role check cannot express record ownership by itself.
Broken edit flagged · corrected edit passes
PHP
A transaction can commit invalid business state if the application ignores the result of a conditional write. The stock predicate prevents an overdraw, and the affected-row check prevents creating an order that reserved nothing.
Broken edit flagged · corrected edit passes
Use a correction as a saved requirement
Choose the failure you need to prevent, add the scoped rule to your repository, and check both the broken and corrected implementation. Ask your agent to inspect the finding, repair the code and recheck the same rule. Keep framework tests beside the model check.
Perch keeps the requirement beside the code. Reuse the named check during the agent’s next edit and in CI, with cached answers free on unchanged requests.
Official Symfony documentation · All language and framework recipes