mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-03-19 12:18:05 +00:00
Add TriggerAuditInterface and TriggerAuditService to handle audit event triggering
- 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.
This commit is contained in:
39
src/Bundle/ChillMainBundle/Audit/TriggerAuditInterface.php
Normal file
39
src/Bundle/ChillMainBundle/Audit/TriggerAuditInterface.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?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;
|
||||
}
|
||||
Reference in New Issue
Block a user