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 AddressCreationSpecProvider implements Generic\SpecProviderInterface { | |
8 | ||
9 | /** | |
10 | * @param \Civi\Api4\Service\Spec\RequestSpec $spec | |
11 | */ | |
12 | public function modifySpec(RequestSpec $spec) { | |
13 | $spec->getFieldByName('contact_id')->setRequired(TRUE); | |
14 | $spec->getFieldByName('location_type_id')->setRequired(TRUE); | |
15 | } | |
16 | ||
17 | /** | |
18 | * @param string $entity | |
19 | * @param string $action | |
20 | * | |
21 | * @return bool | |
22 | */ | |
23 | public function applies($entity, $action) { | |
24 | return $entity === 'Address' && $action === 'create'; | |
25 | } | |
26 | ||
27 | } |