gharlan / propel-event-dispatcher-behavior
将 Symfony EventDispatcher 组件集成到 Propel 的模型类中。
3.2
2022-06-30 19:35 UTC
Requires
- symfony/event-dispatcher: ^5.3|^6.0
README
将 Symfony2 EventDispatcher 组件集成到 Propel 2 alpha 3 的模型类中。最终 Propel 2 的正式发布版本将集成到核心中。这仅适用于已经使用 Propel 2 到 alpha 3 并需要这些行为的用户。
安装
在您的 composer.json
中需要此行为
{ "require": { "willdurand/propel-eventdispatcher-behavior": "dev-master" } }
将以下行添加到您的 propel.ini
或 build.properties
配置文件中
propel.behavior.eventdispatcher.class = vendor.willdurand.propel-eventdispatcher-behavior.src.EventDispatcherBehavior
注意:
vendor.willdurand.propel-eventdispatcher-behavior.src
是行为在点路径表示法中的路径。
最后,将此行为添加到您的 schema.xml
中
<database name="foo"> <table name="a-table"> <behavior name="event_dispatcher" /> </table> </database>
ActiveRecord API
此行为添加了一个单一的方法 getEventDispatcher()
。此方法为每个类创建一个 EventDispatcher
实例。
运行测试
安装依赖项
php composer.phar install --dev
运行测试套件
phpunit
许可证
此行为在 MIT 许可证下发布。有关详细信息,请参阅捆绑的 LICENSE 文件。