Skip to content
tawfekov edited this page Apr 9, 2013 · 1 revision

#ZF2EntityAudit

An module to audit Doctrine 2 entities in ZF2 and browse the audit log. Inspired by https://github.com/simplethings/EntityAudit

##Install

  1. download ZF2EntityAudit from composer
php composer.phar require "tawfekov/zf2entityaudit": "dev-master"

or by adding it to composer.json then using php composer.phar update to install it

  1. Add the ZF2EntityAudit module to your application config config/application.config.php:
return array(
    'modules' => array(
        'ZF2EntityAudit'
        ...
    ),
  1. copy config/zf2entityaudit.global.php.dist to config/autoload/zf2entityaudit.global.php and edit setting as
<?php
return array(
    'audit' => array(
        'datetime.format' => 'r',
        
        'tableNamePrefix' => '',
        'tableNameSuffix' => '_audit',
        'revisionTableName' => 'Revision',
        'revisionEntityTableName' => 'RevisionEntity',
        
        'entities' => array(
            'Application\\Entity\\Type',
        ),
    ),
);

ZFCUser integration will assign the logged-in user to the revision log. If an audited record changes when a user is not logged in or set on the ModuleOptions object Anonymous will be used.

  1. use doctrine command line tool to update the database and created the auditing tables :
vendor/bin/doctrine-module orm:schema-tool:update
  1. viewing the auditing records : Routes are added from /audit This module provides the view layer for browsing the audit log from this route. In production server you can protect this interface with ACL. I'd suggest using BjyAuthorize.

  2. if you find any problems or have ideas to improve this module please let us know

on Github : tawfekov on Twitter: @tawfekov

##Thanks Thanks also flys to TomHAnderson for his Contributions.

Clone this wiki locally