fmasa / doctrine-nullable-embeddables
Doctrine 2.5+ 中 nullable embeddables 的实现机制
1.0.1
2018-02-22 11:30 UTC
Requires
- php: ^7.0
- doctrine/orm: ^2.5
Requires (Dev)
- phpunit/phpcov: ^4.0
- phpunit/phpunit: ^6.0
- satooshi/php-coveralls: ^1.0
This package is auto-updated.
Last update: 2024-09-17 00:02:08 UTC
README
本包作为 Doctrine 2.5+ 中 embeddables 实现 nullable 的解决方案。有关此问题的更多信息,请参阅 doctrine/doctrine2。
安装
使用 Composer 是安装 fmasa/doctrine-yaml-annotations 的最佳方式
$ composer require fmasa/doctrine-nullable-embeddables
必须满足以下条件
- 具有 nullable embeddable 的属性必须使用
Fmasa\DoctrineNullableEmbeddables\Annotations\Nullable
注解。 - nullable embeddable 中的每个属性都必须是可空的(或者如果是 embeddable,则必须使用
Nullable
注解)
现在您只需注册 Fmasa\DoctrineNullableEmbeddables\Subscriber
,即可使 nullable embeddables 正常工作
/* @var $annotationReader Doctrine\Common\Annotations\Reader */ /* @var $em Doctrine\ORM\EntityManager */ $evm->addEventSubscriber(new Fmasa\DoctrineNullableEmbeddables\Subscriber($annotationReader));
但我使用 YAML 进行映射!
请参阅 fmasa/doctrine-yaml-annotations 以了解如何使此类扩展与 YAML 映射一起工作。