Commit | Line | Data |
---|---|---|
19b53e5b C |
1 | <?php |
2 | ||
3 | namespace Civi\Api4\Service\Spec\Provider; | |
4 | ||
5 | use Civi\Api4\Service\Spec\RequestSpec; | |
6 | ||
7 | class MappingCreationSpecProvider implements Generic\SpecProviderInterface { | |
8 | ||
9 | /** | |
10 | * This function runs for both Mapping and MappingField entities | |
11 | * | |
12 | * @param \Civi\Api4\Service\Spec\RequestSpec $spec | |
13 | */ | |
14 | public function modifySpec(RequestSpec $spec) { | |
15 | $spec->getFieldByName('name')->setRequired(TRUE); | |
16 | } | |
17 | ||
18 | /** | |
19 | * @param string $entity | |
20 | * @param string $action | |
21 | * | |
22 | * @return bool | |
23 | */ | |
24 | public function applies($entity, $action) { | |
25 | return strpos($entity, 'Mapping') === 0 && $action === 'create'; | |
26 | } | |
27 | ||
28 | } |