Skip to content

Commit

Permalink
add custom Abstract log for the Loggable behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Cockayne committed Sep 18, 2015
1 parent e8392cc commit ad05d05
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/ZucchiDoctrine/Behaviour/Loggable/AbstractLog.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
namespace ZucchiDoctrine\Behaviour\Loggable;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Loggable\Entity\MappedSuperclass as MappedSuperclass;

/**
* Gedmo\Loggable\Entity\LogEntry
*
* @ORM\Table(
* indexes={
* @ORM\Index(name="log_class_lookup_idx", columns={"object_class"}),
* @ORM\Index(name="log_date_lookup_idx", columns={"logged_at"}),
* @ORM\Index(name="log_user_lookup_idx", columns={"username"}),
* @ORM\Index(name="log_version_lookup_idx", columns={"object_id", "object_class", "version"})
* }
* )
* @ORM\Entity(repositoryClass="Gedmo\Loggable\Entity\Repository\LogEntryRepository")
*/
class AbstractLog extends MappedSuperclass\AbstractLogEntry implements \JsonSerializable
{
/**
* (non-PHPdoc)
* @see JsonSerializable::jsonSerialize()
*/
public function jsonSerialize()
{
return array(
'version' => $this->getVersion(),
'loggedAt'=> $this->getLoggedAt(),
'username' => $this->getUsername(),
'action' => $this->getAction(),
'changes' => $this->getData(),
);
}
}

0 comments on commit ad05d05

Please sign in to comment.