sympress / doctrine-bundle
Native Doctrine ORM, DBAL and Symfony Doctrine bridge integration for SymPress.
Requires
- php: ^8.5
- doctrine/dbal: ^4.3
- doctrine/doctrine-bundle: ^3.3
- doctrine/doctrine-migrations-bundle: ^4.0
- doctrine/orm: ^3.7
- symfony/doctrine-bridge: ^8.1
- sympress/framework-bundle: ^1.0.5
- sympress/kernel: ^1.1.7
Requires (Dev)
- phpstan/phpstan-doctrine: ^2.0
- symfony/doctrine-messenger: ^8.1
- symfony/form: ^8.1
- symfony/maker-bundle: ^1.0
- symfony/property-info: ^8.1
- symfony/security-bundle: ^8.1
- symfony/serializer: ^8.1
- symfony/uid: ^8.1
- symfony/validator: ^8.1
- sympress/qa: ^0.1.2
Suggests
- ext-pdo_mysql: MySQL and MariaDB connections.
- ext-pdo_pgsql: PostgreSQL connections.
- ext-pdo_sqlite: SQLite connections.
- symfony/doctrine-messenger: Doctrine Messenger transports and transaction middleware.
- symfony/form: EntityType and Doctrine-backed form choices.
- symfony/maker-bundle: Development-time entity and migration generation.
- symfony/security-bundle: Doctrine entity user providers for separately configured security firewalls.
- symfony/validator: UniqueEntity and Doctrine-aware validation.
Provides
None
Conflicts
None
Replaces
None
README
Native Doctrine ORM and DBAL integration for the SymPress ecosystem. Uses the
original DoctrineBundle, DoctrineMigrationsBundle and Symfony Doctrine Bridge.
Requires PHP 8.5 and SymPress Kernel >= 1.1.7. Entities and persistence do not depend on wpdb or WordPress
hooks. The package has no dependency on another SymPress persistence package.
Installation
This is a private Composer library. Configure a read-only authenticated VCS
repository in the consuming application's root composer.json:
{"repositories": [{"type": "vcs", "url": "git@github.com:SymPress/doctrine-bundle.git"}]}
Then install the stable release with composer require sympress/doctrine-bundle:^1.0.
The SymPress kernel discovers the bundle through extra.kernel and registers its
Framework and Migrations requirements. Symfony Flex is not required.
Configuration and use
Use native doctrine and doctrine_migrations configuration in your application's
kernel-loaded config directory. Configure entities explicitly by PSR-4 namespace
and path. Use Doctrine\ORM\Mapping attributes, inject
Doctrine\ORM\EntityManagerInterface into application services, and use
Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository for
service-backed repositories. Existing Symfony Doctrine documentation applies.
The complete configuration example and usage are maintained in
examples/.
Optional Symfony integrations require their own components: Form, Validator, SecurityBundle, MakerBundle or Doctrine Messenger. This package preserves the upstream integration; it does not install a WordPress authentication layer.
Database ownership
Use Doctrine for application-owned entities and tables. When sharing a database
with WordPress, configure a schema_filter for every connection used for schema
comparison, including the migrations metadata table. Review generated migrations
and execute them during deployment. Bundle boot never applies schema changes.
Separate wpdb and DBAL connections do not share a transaction. Modify WordPress
and WooCommerce-owned data through their APIs. Tenant selection and work-unit
reset belong to the application, not an implicit WordPress blog switch.
Development
composer install
composer qa
DOCTRINE_TEST_DATABASE_URL='mysql://user:password@127.0.0.1/sympress_doctrine_test' composer tests:database
The default suite verifies the real SymPress kernel and original Doctrine stack against SQLite. Hosted CI also runs disposable MariaDB and PostgreSQL tests. Development dependencies are locked; consumers resolve stable runtime ranges.
License: GPL-2.0-or-later. Upstream dependencies retain their original licenses.