PHP code example of kikwik / doctrine-entity-logger-bundle
1. Go to this page and download the library: Download kikwik/doctrine-entity-logger-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/ */
kikwik / doctrine-entity-logger-bundle example snippets
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Kikwik\DoctrineEntityLoggerBundle\Attributes\LoggableEntity;
#[ORM\Entity(repositoryClass: MyEntityRepository::class)]
#[LoggableEntity]
class MyEntity
{
// ...
}
namespace App\Command;
use Kikwik\DoctrineEntityLoggerBundle\Service\EntityLoggerConfig;
class DoSomethingCommand extends Command
{
public function __construct(
private EntityLoggerConfig $entityLoggerConfig,
)
{
parent::__construct();
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->entityLoggerConfig->setEnabled(false);
//...
}
}
namespace App\Controller\Admin;
use Kikwik\DoctrineEntityLoggerBundle\EasyAdmin\KikwikLogCrudController;
class LogCrudController extends KikwikLogCrudController
{
}
namespace App\Controller\Admin;
use Kikwik\DoctrineEntityLoggerBundle\Entity\Log;
class DashboardController extends AbstractDashboardController
{
public function configureMenuItems(): iterable
{
// ....
yield MenuItem::section('Log');
yield MenuItem::linkToCrud('Log azioni', 'fas fa-history', Log::class);
}
}
namespace App\Controller\Admin;
use Kikwik\DoctrineEntityLoggerBundle\EasyAdmin\LogField;
class MyCrudController extends AbstractCrudController
{
public function configureFields(string $pageName): iterable
{
// ...
yield LogField::new('log'); // 'log' is a dummy name
}
}