adt/doctrine-loggable

Logging of changes in Doctrine entities

Installs: 21 350

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 13

Forks: 3

Open Issues: 0

pkg:composer/adt/doctrine-loggable

v2.0.6 2025-01-27 07:16 UTC

README

Installation

  1. Install via composer:

    composer require adt/doctrine-loggable
  2. Register this extension in your config.neon:

    extensions:
        - ADT\DoctrineLoggable\DI\LoggableExtension
  3. Do database migrations

  4. Add annotation to entities you wish to log

<?php

use Doctrine\ORM\Mapping as ORM;
use ADT\DoctrineLoggable\Attributes as ADA;
	
/**
 * @ORM\Entity
 * @ADA\LoggableEntity
 */
class User
{

	/**
	 * @ORM\Column(type="string", nullable=true)
	 * @ADA\LoggableProperty(label="entity.user.firstname")
	 */
	protected $firstname;

	/**
	 * @ORM\ManyToMany(targetEntity="Role", inversedBy="users")
	 * @ADA\LoggableProperty(logEntity=false, label="entity.user.roles")
	 */
	protected $roles;
	
}

/**
 * @ORM\Entity
 * @ADA\LoggableIdentification(fields={"name"})
 */
class Role
{

	/**
	 * @ORM\Column(type="string")
	 */
	protected $name;

	/**
	 * @ORM\ManyToMany(targetEntity="User", mappedBy="roles")
	 */
	protected $users;

}