temirkhan / flush-listener
There is no license information available for the latest version (1.2.0) of this package.
Entity manager flush listener
Package info
github.com/TemirkhanN/flush-listener
Type:symfony-bundle
pkg:composer/temirkhan/flush-listener
1.2.0
2019-01-07 21:06 UTC
Requires
- php: >=7.0
- doctrine/orm: ^2.5
- symfony/config: ^4.2
- symfony/dependency-injection: ^4.2
- symfony/http-kernel: ^4.2
Requires (Dev)
- phpunit/phpunit: ^6.0
- satooshi/php-coveralls: ^1.0
- squizlabs/php_codesniffer: ^3.0
This package is auto-updated.
Last update: 2026-02-16 06:13:11 UTC
README
Automatically flushes entity manager on valid symfony response status code.
Works with symfony event dispatcher
Installation
Install bundle by composer
composer require temirkhan/flush-listener
Enable it in your app/AppKernel.php
<?php #app/AppKernel.php ... class AppKernel extends Kernel { public function registerBundles() { $bundles = [ ..., new Temirkhan\FlushListenerBundle\TemirkhanFlushListenerBundle(), ]; } ...
Usage
This is it. Now when symfony finishes handling request and return response entity manager will be flushed based on response status code.
To force flushing event dispatcher shall be used.
$dispatcher->dispatch('transaction.commit');
To prevent flushing
$dispatcher->dispatch('transaction.rollback');
This mechanism best suites postgres.