Download the PHP package somnambulist/laravel-doctrine-entity-audit without Composer
On this page you can find all versions of the php package somnambulist/laravel-doctrine-entity-audit. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download somnambulist/laravel-doctrine-entity-audit
More information about somnambulist/laravel-doctrine-entity-audit
Files in somnambulist/laravel-doctrine-entity-audit
Package laravel-doctrine-entity-audit
Short Description A port of the SimpleThings EntityAudit package re-worked for Laravel 5+
License LGPL-2.1
Informations about the package laravel-doctrine-entity-audit
Entity Auditing for Doctrine in Laravel
This is a fork of the SimpleThings EntityAudit project, re-worked for usage with Laravel and the Laravel-Doctrine package. It maintains the same style of working, generating a revision for all tagged entities.
Need a Symfony based version? Check out the original SimpleThings EntityAudit.
To protect from conflicts it has been re-namespaced and some internals changed.
Installation
- composer require somnambulist/laravel-doctrine-entity-audit
- add the ServiceProvider to your config/app.php after the Doctrine provider
- ./artisan vendor:publish
- update the config file and then generate the audit tables:
- ./artisan doctrine:migrations:diff
- ./artisan doctrine:migrations:migrate
Configuring UserResolver
The UserResolver implementation may be switched out for another implementation by implementing the
UserResolverInterface
and binding this to the container in your AppServiceProvider
. This needs
to be during registration and not boot.
Alternatively: the UserResolver
may be switched out at run time by accessing the AuditConfiguration
from the AuditRegistry
for the entity manager and setting a new resolver instance:
If the entity manager name is not specified, the default will be chosen. Note that the configuration
is shared with the AuditReader
. It is recommended to set the UserResolver this way as early as
possible and preferably before loading and modifying any entities to avoid issues with user resolution.
Unit Tests
The existing unit tests have been ported over excluding the Gedmo soft-deleteable. To run the unit tests, ensure the dev dependencies have been installed:
- vendor/bin/phpunit
Todo
- refactor and simplify the listener internals
- remove any remaining deprecated Doctrine API calls
From SimpleThings:
- currently only works with auto-increment databases
- proper metadata mapping is necessary, allow to disable versioning for fields and associations.
- support Joined-Table-Inheritance
- support many-to-many auditing