core23 / doctrine-extensions
Useful doctrine event hooks.
Fund package maintenance!
core23
Opencollective
Ko-Fi
Other
Installs: 7 781
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 2
Requires
- php: ^7.2
- doctrine/common: ^2.8
- doctrine/dbal: ^2.6
- doctrine/event-manager: ^1.0
- doctrine/orm: ^2.5
- sonata-project/doctrine-extensions: ^1.3.1
- symfony/property-access: ^4.2 || ^5.0
Requires (Dev)
- bamarni/composer-bin-plugin: ^1.3
- doctrine/doctrine-bundle: ^1.11 || ^2.0
- ergebnis/composer-normalize: ^2.0.1
- symfony/browser-kit: ^4.4 || ^5.0
- symfony/dependency-injection: ^4.2 || ^5.0
- symfony/expression-language: ^4.2 || ^5.0
- symfony/framework-bundle: ^4.2 || ^5.0
Suggests
- symfony/framework-bundle: If you want to use symfony
Conflicts
- symfony/framework-bundle: <4.2
This package is auto-updated.
Last update: 2020-06-27 18:23:26 UTC
README
This library provides adds some useful doctrine hooks.
Installation
Open a command console, enter your project directory and execute the following command to download the latest stable version of this library:
composer require core23/doctrine-extensions
Usage
Confirmable entities
If you need entities that needs to be confirmed, just implement the Core23\Doctrine\Model\ConfirmableInterface
in your entity class.
If you don't need the symfony framework, you need to register the Core23\Doctrine\EventListener\ORM\ConfirmableListener
.
Deleteable entities
If you need entities that should be soft deleted, just implement the Core23\Doctrine\Model\DeletableInterface
in your entity class.
If you don't need the symfony framework, you need to register the Core23\Doctrine\EventListener\ORM\DeletableListener
.
Lifecyle aware enties
If you need lifecyle information (creation / update date), just implement the Core23\Doctrine\Model\LifecycleDateTimeInterface
in your entity class.
If you don't need the symfony framework, you need to register the Core23\Doctrine\EventListener\ORM\LifecycleDateListener
.
Position aware entities
If you need sortable entities, just implement the Core23\Doctrine\Model\PositionAwareInterface
in your entity class.
If you don't need the symfony framework, you need to register the Core23\Doctrine\EventListener\ORM\SortableListener
.
Unique active entities
If you need entities that should only have one active state, just implement the Core23\Doctrine\Model\UniqueActiveInterface
in your entity class.
If you don't need the symfony framework, you need to register the Core23\Doctrine\EventListener\ORM\UniqueActiveListener
.
Table prefix
If you need a prefix for all of you application tables and sequences, you could use the TablePrefixEventListener
.
If the table name does already start with the defined prefix, it will be ignored.
If you don't need the symfony framework, you need to register the Core23\Doctrine\EventListener\ORM\TablePrefixEventListener
.
Symfony usage
If you want to use this library inside symfony, you can use a bridge.
Enable the Bundle
Then, enable the bundle by adding it to the list of registered bundles in config/bundles.php
file of your project:
// config/bundles.php return [ // ... Core23\Doctrine\Bridge\Symfony\Bundle\Core23DoctrineBundle::class => ['all' => true], ];
Configure the Bundle
Create a configuration file called core23_doctrine.yaml
:
# config/packages/core23_doctrine.yaml core23_doctrine: table: prefix: 'acme_'
License
This library is under the MIT license.