<?php
//----------------------------------------------------------------------
// src/Logging/DeletionContextLogger.php
// Plan.io Task #3922
// Doctrine’s remove process may clean out relationships depending on fetch strategy,
// cascade settings, and state of the UnitOfWork.
//----------------------------------------------------------------------
namespace App\Logging;
use Doctrine\Persistence\ManagerRegistry;
use App\Entity\Access;
use App\Entity\Platform\Installment;
use App\Services\LogTools;
class DeletionContextLogger
{
public function __construct(ManagerRegistry $doctrine, LogTools $logTools)
{
$this->em = $doctrine->getManager();
$this->logTools = $logTools;
}
private array $context = [];
public function storeContext(object $entity, array $data): void
{
$this->context[spl_object_hash($entity)] = $data;
}
public function getContext(object $entity): ?array
{
return $this->context[spl_object_hash($entity)] ?? null;
}
public function clear(): void
{
$this->context = [];
}
}