|
19 | 19 |
|
20 | 20 | namespace Civi\Funding\Api4\Action\Remote\FundingCase;
|
21 | 21 |
|
22 |
| -use Civi\Api4\Generic\Result; |
23 |
| -use Civi\Core\CiviEventDispatcherInterface; |
| 22 | +use Civi\Api4\RemoteFundingCase; |
| 23 | +use Civi\Funding\Api4\Action\Remote\AbstractRemoteFundingAction; |
24 | 24 | use Civi\Funding\Api4\Action\Remote\FundingCase\Traits\NewApplicationFormActionTrait;
|
25 | 25 | use Civi\Funding\Api4\Action\Traits\FundingCaseTypeIdParameterTrait;
|
26 | 26 | use Civi\Funding\Api4\Action\Traits\FundingProgramIdParameterTrait;
|
27 |
| -use Civi\Funding\Event\Remote\FundingCase\GetNewApplicationFormEvent; |
28 |
| -use Civi\Funding\Exception\FundingException; |
29 |
| -use Civi\Funding\FundingProgram\FundingCaseTypeManager; |
30 |
| -use Civi\Funding\FundingProgram\FundingCaseTypeProgramRelationChecker; |
31 |
| -use Civi\Funding\FundingProgram\FundingProgramManager; |
32 |
| -use CRM_Funding_ExtensionUtil as E; |
33 | 27 |
|
34 |
| -class GetNewApplicationFormAction extends AbstractNewApplicationFormAction { |
| 28 | +class GetNewApplicationFormAction extends AbstractRemoteFundingAction { |
35 | 29 |
|
36 | 30 | use FundingCaseTypeIdParameterTrait;
|
37 | 31 |
|
38 | 32 | use FundingProgramIdParameterTrait;
|
39 | 33 |
|
40 | 34 | use NewApplicationFormActionTrait;
|
41 | 35 |
|
42 |
| - public function __construct( |
43 |
| - FundingCaseTypeManager $fundingCaseTypeManager, |
44 |
| - FundingProgramManager $fundingProgramManager, |
45 |
| - CiviEventDispatcherInterface $eventDispatcher, |
46 |
| - FundingCaseTypeProgramRelationChecker $relationChecker |
47 |
| - ) { |
48 |
| - parent::__construct( |
49 |
| - 'getNewApplicationForm', |
50 |
| - $fundingCaseTypeManager, |
51 |
| - $fundingProgramManager, |
52 |
| - $eventDispatcher, |
53 |
| - $relationChecker, |
54 |
| - ); |
55 |
| - } |
56 |
| - |
57 |
| - /** |
58 |
| - * @inheritDoc |
59 |
| - * |
60 |
| - * @throws \CRM_Core_Exception |
61 |
| - */ |
62 |
| - public function _run(Result $result): void { |
63 |
| - $this->assertFundingCaseTypeAndProgramRelated($this->getFundingCaseTypeId(), $this->getFundingProgramId()); |
64 |
| - $event = $this->createEvent(); |
65 |
| - $this->dispatchEvent($event); |
66 |
| - |
67 |
| - $result->debug['event'] = $event->getDebugOutput(); |
68 |
| - if (NULL === $event->getJsonSchema() || NULL === $event->getUiSchema()) { |
69 |
| - throw new FundingException(E::ts('Invalid funding program ID or funding case type ID'), 'invalid_arguments'); |
70 |
| - } |
71 |
| - |
72 |
| - $result->rowCount = 1; |
73 |
| - $result->exchangeArray([ |
74 |
| - 'jsonSchema' => $event->getJsonSchema(), |
75 |
| - 'uiSchema' => $event->getUiSchema(), |
76 |
| - 'data' => $event->getData(), |
77 |
| - ]); |
78 |
| - } |
79 |
| - |
80 |
| - /** |
81 |
| - * @throws \CRM_Core_Exception |
82 |
| - */ |
83 |
| - private function createEvent(): GetNewApplicationFormEvent { |
84 |
| - return GetNewApplicationFormEvent::fromApiRequest( |
85 |
| - $this, |
86 |
| - $this->createEventParams($this->getFundingCaseTypeId(), $this->getFundingProgramId()), |
87 |
| - ); |
| 36 | + public function __construct() { |
| 37 | + parent::__construct(RemoteFundingCase::getEntityName(), 'getNewApplicationForm'); |
88 | 38 | }
|
89 | 39 |
|
90 | 40 | }
|
0 commit comments