PHP code example of codyas / audit-bundle
1. Go to this page and download the library: Download codyas/audit-bundle library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
codyas / audit-bundle example snippets
# config/bundles.php
return [
// ...
Codyas\Audit\AuditBundle::class => ['all' => true],
// ...
];
namespace App\Entity;
use Codyas\Audit\Model\AuditableInterface;
use Codyas\Audit\Model\MasterAuditableInterface;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
#[ORM\Entity(repositoryClass: AcmeRepository::class)]
class Acme implements AuditableInterface, MasterAuditableInterface
{
}
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
#[Groups("audit")]
private ?int $id = null;
#[Groups("audit")]
#[ORM\OneToMany(mappedBy: 'acmeInstance', targetEntity: AcmeDependant::class)]
private Collection $dependants;
namespace App\Entity;
use Codyas\Audit\Model\AuditableInterface;
use Codyas\Audit\Model\SlaveAuditableInterface;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
#[ORM\Entity(repositoryClass: AcmeDependant::class)]
class AcmeDependant implements AuditableInterface, SlaveAuditableInterface
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
#[Groups("audit")]
private ?int $id = null;
#[ORM\ManyToOne(inversedBy: 'dependants')]
private ?Acme $acmeInstance = null;
public function getMaster(): ?MasterAuditableInterface
{
return $this->acmeInstance;
}
public function getMasterNamespace(): ?string
{
return Acme::class;
}