dravencms / database
DravenCMS Database
Package info
Type:dravencms-package
pkg:composer/dravencms/database
Requires
- php: >= 7.3.0
- dravencms/console: >=0.0.1
- dravencms/logging: >=0.0.1
- nette/di: ^3.0.9
- nettrine/annotations: ^0.9.0
- nettrine/dbal: ^0.10.3
- nettrine/extensions-atlantic18: ^0.7.1
- nettrine/fixtures: ^0.9.0
- nettrine/migrations: ^v0.10.1
- nettrine/orm: ^0.10.1
README
Doctrine ORM and Nettrine integration for DravenCMS. It configures the database connection, entity manager, migrations, fixtures, common entity traits, and package fixture discovery.
Features
- Nettrine DBAL and Doctrine ORM configuration.
- Project migrations stored under
migrations/and grouped by year. - Fixture loading from installed DravenCMS packages.
- DravenCMS entity manager and default repository classes.
- Reusable identifier, UUID, timestamp, and soft-delete traits.
- Atlantic18 behavior extension integration.
Installation
composer require dravencms/database
Define the connection parameters used by dravencms.config.neon:
parameters: database: driver: pdo_mysql host: 127.0.0.1 port: 3306 user: app password: secret dbname: app
Store production credentials in local or environment-specific configuration.
Entity Mapping
Feature packages add mappings to nettrine.orm.managers.default.mapping. New entities should use Doctrine PHP attributes. Common DravenCMS entities can compose these traits:
use Dravencms\Database\Attributes\Identifier; use Dravencms\Database\Attributes\TimestampableEntity; class Article { use Identifier; use TimestampableEntity; }
Migrations and Fixtures
Use the application's Nettrine/Doctrine console commands to generate and execute migrations. To purge the database and load all fixtures registered by DravenCMS package extensions, run:
php bin/console database:default-data:load
The default-data command is destructive because Doctrine's fixture executor purges existing mapped data before loading fixtures. Run it only against a database that may be reset.
License
This package is licensed under the LGPL-3.0 license.