evozon-php / doctrine-extensions
Doctrine2 behavioral extensions.
Installs: 9 537
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 1
Open Issues: 0
Requires
- php: >=5.3.2
- gedmo/doctrine-extensions: *
Requires (Dev)
- doctrine/common: >=2.5.0
- doctrine/orm: >=2.5.0
- phpunit/phpunit: *
- symfony/yaml: ~2.6|~3.0
This package is auto-updated.
Last update: 2025-02-23 18:47:13 UTC
README
This package is ment to be a slight variation of the original DoctrineExtensions.
Install
composer install evozon-php/doctrine-extensions
Differences
SoftDeleteable
The original SoftDeleteable
behavior was to use timestamp column that was either NULL
or the date time of deletion.
While some RDBMs can index NULL-able values, some can not (like Oracle). This means it will always do a full table scan.
The modified SoftDeleatable
behavior is to use a boolean (true
/false
) or equivalent numeric (1
/0
) value to represent the soft deleteable state.
Usage
Assuming you are using DoctrineBundle and StofDoctrineExtensionsBundle.
Add the filter to config.yml
, or change the original softdeleteable
:
orm:
...
entity_managers:
default:
...
filters:
softdeleteable:
class: EvozonPhp\SoftDeleteable\Filter\SoftDeleteableFilter
enabled: true
and add the SoftDeleteableListener
to your services.yml
:
services:
evozonphp.listener.softdeleteable:
class: EvozonPhp\SoftDeleteable\SoftDeleteableListener
tags:
- { name: doctrine.event_subscriber, connection: default }
calls:
- [ setAnnotationReader, [ "@annotation_reader" ] ]
Contributors:
Thanks to everyone participating in the development of the Doctrine2 extensions!