jalismrs / symfony.bundle.event.operation
添加带有监听器的操作事件
该软件包的官方仓库似乎已消失,因此该软件包已被冻结。
1.1.1
2021-03-04 10:49 UTC
Requires
- php: ^7.4 || ^8.0
- jalismrs/symfony.common.event: ^1.0.0
- symfony/config: ^5.0
- symfony/dependency-injection: ^5.0
- symfony/event-dispatcher-contracts: ^2.2.0
- symfony/http-kernel: ^5.0
Requires (Dev)
- composer/package-versions-deprecated: *
- phpunit/phpunit: 9.4.2
- roave/security-advisories: dev-master
README
添加带有监听器的操作事件
测试
phpunit
或vendor/bin/phpunit
覆盖率报告将在var/coverage
中可用
使用
假设事件监听器已激活并配置
use Jalismrs\Symfony\Bundle\JalismrsOperationEventBundle\Event\OperationMarkEvent; use Jalismrs\Symfony\Bundle\JalismrsOperationEventBundle\Event\OperationCleanEvent; use Symfony\Component\EventDispatcher\EventDispatcher; class SomeClass { private EventDispatcher $eventDispatcher; public function someFunction(): void { $count = 1; $operationMarkEvent = new OperationMarkEvent( $count ); $this->eventDispatcher->dispatch($operationMarkEvent); // do something $count = 0; $operationCleanEvent = new OperationCleanEvent( $count ); $this->eventDispatcher->dispatch($operationCleanEvent); } }