mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-03-19 04:08:06 +00:00
- Introduced `TriggerAuditInterface` to define the contract for triggering audit events. - Implemented `TriggerAuditService` to encapsulate audit event creation and persistence logic. - Added methods to handle audit actions with metadata and translatable descriptions.
40 lines
1.9 KiB
PHP
40 lines
1.9 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/*
|
|
* Chill is a software for social workers
|
|
*
|
|
* For the full copyright and license information, please view
|
|
* the LICENSE file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Chill\MainBundle\Audit;
|
|
|
|
use Symfony\Contracts\Translation\TranslatableInterface;
|
|
|
|
interface TriggerAuditInterface
|
|
{
|
|
/**
|
|
* Handles the triggering of an audit event with the provided details.
|
|
*
|
|
* @param string $action the action to be performed
|
|
* @param object $mainSubject the primary subject on which the action is performed
|
|
* @param array $subjects an array of additional subjects related to the action
|
|
* @param string|TranslatableInterface $description a description of the action, which can be a string or a translatable interface
|
|
* @param array $metadata optional metadata associated with the action
|
|
*/
|
|
public function triggerAudit(string $action, object $mainSubject, array $subjects = [], string|TranslatableInterface $description = '', array $metadata = []): void;
|
|
|
|
/**
|
|
* Handles the invocation of an action with the provided main subject and additional subjects.
|
|
*
|
|
* @param string $action the action to be performed
|
|
* @param object $mainSubject the primary subject on which the action is performed
|
|
* @param array $subjects an array of additional subjects related to the action
|
|
* @param string|TranslatableInterface $description a description of the action, which can be a string or a translatable interface
|
|
* @param array $metadata optional metadata associated with the action
|
|
*/
|
|
public function __invoke(string $action, object $mainSubject, array $subjects = [], string|TranslatableInterface $description = '', array $metadata = []): void;
|
|
}
|