Commit | Line | Data |
---|---|---|
8badd1d8 CW |
1 | <?php |
2 | ||
3 | /* | |
4 | +--------------------------------------------------------------------+ | |
5 | | Copyright CiviCRM LLC. All rights reserved. | | |
6 | | | | |
7 | | This work is published under the GNU AGPLv3 license with some | | |
8 | | permitted exceptions and without any warranty. For full license | | |
9 | | and copyright information, see https://civicrm.org/licensing | | |
10 | +--------------------------------------------------------------------+ | |
11 | */ | |
12 | namespace Civi\Api4\Event; | |
13 | ||
14 | use Civi\Core\Event\GenericHookEvent; | |
15 | ||
16 | /** | |
17 | * civi.api4.createRequest event. | |
18 | * | |
19 | * This event fires whenever resolving the name of an api entity to an api class. | |
20 | * | |
21 | * e.g. the entity name "Contact" resolves to the class `Civi\Api4\Contact` | |
22 | * and the entity "Case" resolves to `Civi\Api4\CiviCase` | |
23 | */ | |
24 | class CreateApi4RequestEvent extends GenericHookEvent { | |
25 | ||
26 | /** | |
27 | * Name of the entity to matched to an api class | |
28 | * | |
29 | * @var string | |
30 | */ | |
31 | public $entityName; | |
32 | ||
33 | /** | |
34 | * Resolved fully-namespaced class name. | |
35 | * | |
36 | * @var string | |
37 | */ | |
38 | public $className; | |
39 | ||
40 | /** | |
41 | * Additional arguments which should be passed to the action factory function. | |
42 | * | |
43 | * For example, `Civi\Api4\CustomValue` factory functions require the name of the custom group. | |
44 | * | |
45 | * @var array | |
46 | */ | |
47 | public $args = []; | |
48 | ||
49 | /** | |
50 | * Event constructor | |
51 | */ | |
52 | public function __construct($entityName) { | |
53 | $this->entityName = $entityName; | |
54 | } | |
55 | ||
56 | } |