evozon-php / doctrine-extensions
Doctrine2行为扩展。
v1.0.0
2018-06-28 09:42 UTC
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: 2024-09-23 18:02:45 UTC
README
此包旨在是原始 DoctrineExtensions 的一点点变化。
安装
composer install evozon-php/doctrine-extensions
差异
SoftDeleteable
原始 SoftDeleteable
行为是使用时间戳列,该列可以是 NULL
或删除的日期时间。
虽然一些RDBMS可以索引可空值,但有些不能(如Oracle)。这意味着它将始终执行全表扫描。
修改后的 SoftDeleatable
行为是使用布尔值(true
/false
)或等效的数字值(1
/0
)来表示 软删除 状态。
用法
假设您正在使用 DoctrineBundle 和 StofDoctrineExtensionsBundle。
将过滤器添加到 config.yml
,或更改原始的 softdeleteable
orm:
...
entity_managers:
default:
...
filters:
softdeleteable:
class: EvozonPhp\SoftDeleteable\Filter\SoftDeleteableFilter
enabled: true
并将 SoftDeleteableListener
添加到您的 services.yml
services:
evozonphp.listener.softdeleteable:
class: EvozonPhp\SoftDeleteable\SoftDeleteableListener
tags:
- { name: doctrine.event_subscriber, connection: default }
calls:
- [ setAnnotationReader, [ "@annotation_reader" ] ]
贡献者
感谢 所有参与 Doctrine2 扩展开发的人!