Lars Hansen
Lars Hansen

Reputation: 159

How to log users activity in Symfony

Very simple question I'm not able to find a good answer for...

I have a lot of Entities in my Symfony 2.6 - when ever a user makes some changes to any one of them I would like to have a log entry with who/what/where.

Who maked the changes. (user id) What did he/she do. ( POST/PUT data) Where was this done (which entity / url)

[EDIT]

It could perhaps just be a table with these columns:

[/EDIT]

Is there a bundle for this?

Upvotes: 1

Views: 6713

Answers (2)

Ben Hillier
Ben Hillier

Reputation: 2104

You have several Bundles out there that do this, a couple of which have already been mentioned. I've had a lot of success with Gedmo Doctrine Extensions.

Some Documentation here: http://symfony.com/doc/current/cookbook/doctrine/common_extensions.html

And installation instructions here: https://github.com/Atlantic18/DoctrineExtensions/blob/master/doc/symfony2.md

The installation is the tough part. Once that's done, all you need to do is annotate any entity fields you wish to log.

Upvotes: 2

hanzi
hanzi

Reputation: 2987

For my projects I usually use the EntityAudit bundle. What it does is save a copy of the old state whenever an audited entity is changed. By comparing those to the current version you can see what has changed.

It also gives you a revision history that lists all the entities that have changed in your database.

Upvotes: 2

Related Questions