kikwik / doctrine-entity-logger-bundle
Listener for doctrine entity changes
Installs: 15
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=8.1
- doctrine/doctrine-bundle: 2.*
- doctrine/orm: 3.*
- stof/doctrine-extensions-bundle: ^1.7
- symfony/framework-bundle: ^6.4|^7.0
Requires (Dev)
- ext-pdo_sqlite: *
- phpunit/phpunit: >9.0
- symfony/yaml: ^6.4|^7.0
README
⚠️ Note: This bundle is a work in progress and may be subject to changes.
The KikwikDoctrineEntityLoggerBundle is a Symfony bundle designed to log changes made to Doctrine entities. With this bundle, you can easily track modifications to your database entities and maintain a historical record of changes in a dedicated table.
Key Features:
- Automatic logging of updates, inserts, and deletions for Doctrine entities.
- Stores change history in a database table (
kw_entity_log
) for easy access and review. - Integrates seamlessly with Symfony projects.
This bundle enables quick and effective logging of entity changes, making it a valuable tool for projects requiring audit trails or entity history tracking.
This bundle is inspired by the manasbala/doctrine-log-bundle and the gedmo/doctrine-extensions projects.
The tests for this bundle were developed with the help of the following article: Symfony functional tests for standalone bundles.
Installation
Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.
Open a command console, enter your project directory and execute:
$ composer require kikwik/doctrine-entity-logger-bundle
Update the database to create the logger table (kw_entity_log):
$ php bin/console make:migration $ php bin/console doctrine:migrations:migrate
Usage
Add the \Kikwik\DoctrineEntityLoggerBundle\Attributes\LoggableEntity
attribute to the entities you want to log
Easy Admin
If you are using easy admin you can create a ready-to-use Crud controller by extending KikwikLogCrudController
:
namespace App\Controller\Admin; use Kikwik\DoctrineEntityLoggerBundle\EasyAdmin\KikwikLogCrudController; class LogCrudController extends KikwikLogCrudController { }