Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
50.00% covered (danger)
50.00%
1 / 2
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
RecordCreatedEvent
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5/** @license For full copyright and license information, please see the LICENSE.md file. */
6
7namespace App\Core\Engine\Domain\Event;
8
9defined('AMMONLY_APP') || exit('Direct script access is forbidden.');
10
11use App\Core\Engine\Domain\Model\PermissionContext;
12
13/**
14 * Record Created Domain Event.
15 *
16 * Dispatched via Yii3 EventDispatcher (PSR-14) after a successful
17 * record creation operation. Consumed by AuditCreateListener.
18 *
19 * @package App\Core\Engine\Domain\Event
20 */
21final readonly class RecordCreatedEvent
22{
23    /**
24     * RecordCreatedEvent constructor.
25     *
26     * @param string            $moduleName Module name where record was created.
27     * @param int               $recordId   Primary key of the newly created record.
28     * @param array<string, mixed> $payload Full snapshot of the created record data.
29     * @param PermissionContext $context    Security context of the actor.
30     */
31    public function __construct(
32        public readonly string            $moduleName,
33        public readonly int               $recordId,
34        public readonly array             $payload,
35        public readonly PermissionContext  $context,
36    ) {
37    }
38}