Skip to content

feat: hide doctrine:fixtures:load from production containers - #2

Merged
brianvarskonst merged 2 commits into
mainfrom
feat/production-guard
Nov 14, 2026
Merged

brianvarskonst merged 2 commits into
mainfrom
feat/production-guard

Conversation

@brianvarskonst

Copy link
Copy Markdown
Member

What

  • ProductionGuardPass removes the console.command tag from doctrine.fixtures_load_command when kernel.environment is prod or production. Loading fixtures purges every Doctrine-mapped table; with SymPress' extra.kernel discovery the bundle is active in every environment it is installed in, so an accidental non-dev install must not expose the purge. The pass runs before the kernel collects console commands; upstream passes still see the service, which is then removed as unused.
  • Kernel integration tests against SQLite through the real SymPress kernel and ConsoleApplicationFactory:
    • fixtures load twice (purge + reload), references and DependentFixtureInterface ordering resolve,
    • a WordPress-style wp_posts table and its row survive the purge (ORM purger only touches mapped tables),
    • native --group and --append options,
    • the production container has no doctrine:fixtures:load, while other Doctrine commands stay available.
  • Dev dependency phpstan/phpstan-doctrine (same as sympress/doctrine-bundle) so PHPStan understands generated entity IDs.

Verification

composer qa passes locally on PHP 8.5 (5 tests, 37 assertions).

Loading fixtures purges every Doctrine-mapped table. A compiler pass drops
the console.command tag when kernel.environment is prod or production, so an
accidental production install cannot expose the purge.
Covers purge scope (WordPress tables survive), references, dependencies,
--append, --group and the production guard against SQLite.
@brianvarskonst
brianvarskonst merged commit 965a5f9 into main Nov 14, 2026
3 checks passed
@brianvarskonst
brianvarskonst deleted the feat/production-guard branch November 14, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant