2017 © Pedro PelĂĄez
 

library caf-doctrine-logger

ZF2 Module that logs doctrine operations

image

caferrari/caf-doctrine-logger

ZF2 Module that logs doctrine operations

  • Friday, May 16, 2014
  • by caferrari
  • Repository
  • 1 Watchers
  • 4 Stars
  • 12 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Doctrine Entity Logger

This module have the responsability to log Doctrine Operations on Entities like Insert, Update and Delete, (*1)

To enable the module, just copy the dist configuration to your config/autoload directory and edit the configurations as you like, (*2)

cp vendor/caferrari/caf-doctrine-logger/config/module.config.php.dist config/autoload/doctrine_logger.global.php

After that, add the module to your 'config/application.config.php', (*3)

<?php
// ...
'modules' => array(
    // ...
    'CafDoctrineLogger'
)

To enable the logging on your entities, just implement the interface CafDoctrineLogger\Loggable:, (*4)

<?php

namespace Application\Entity;

use Doctrine\ORM\Mapping as ORM;
use CafDoctrineLogger\Loggable;

/**
 * @ORM\Entity
 * @ORM\Table(name="category")
 * @ORM\HasLifecycleCallbacks
 */
class Category implements Loggable
{

    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue
     */
    protected $id;

    /**
     * @ORM\Column(type="string", length=50, nullable=false)
     */
    protected $name;

    public function toArray()
    {
        return [
            'id' => $this->id,
            'name' => $this->name
        ];
    }
}

Make sure that the php has permissions to write in the query log directory., (*5)

The Versions

16/05 2014

dev-master

9999999-dev

ZF2 Module that logs doctrine operations

  Sources   Download

MIT

The Requires

 

zf2 doctrine module