kikwik/doctrine-entity-logger-bundle

Listener for doctrine entity changes

v0.2.4 2025-05-04 13:24 UTC

This package is auto-updated.

Last update: 2025-05-04 13:24:27 UTC


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
{

}