|
| 1 | +<?php |
| 2 | +/* |
| 3 | + * Copyright (C) 2025 SYSTOPIA GmbH |
| 4 | + * |
| 5 | + * This program is free software: you can redistribute it and/or modify |
| 6 | + * it under the terms of the GNU Affero General Public License as published by |
| 7 | + * the Free Software Foundation in version 3. |
| 8 | + * |
| 9 | + * This program is distributed in the hope that it will be useful, |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | + * GNU Affero General Public License for more details. |
| 13 | + * |
| 14 | + * You should have received a copy of the GNU Affero General Public License |
| 15 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | + */ |
| 17 | + |
| 18 | +declare(strict_types = 1); |
| 19 | + |
| 20 | +namespace Civi\Funding\ApplicationProcess\Api4\ActionHandler\ApplicationProcessActivity; |
| 21 | + |
| 22 | +use Civi\Api4\FundingApplicationProcessActivity; |
| 23 | +use Civi\Api4\Generic\Result; |
| 24 | +use Civi\Funding\ActivityTypeIds; |
| 25 | +use Civi\Funding\ActivityTypeNames; |
| 26 | +use Civi\Funding\Api4\Action\Remote\RemoteFundingGetAction; |
| 27 | +use Civi\Funding\Api4\ActionHandler\AbstractRemoteFundingGetActionHandler; |
| 28 | + |
| 29 | +final class RemoteGetActionHandler extends AbstractRemoteFundingGetActionHandler { |
| 30 | + |
| 31 | + public const ENTITY_NAME = 'RemoteFundingApplicationProcessActivity'; |
| 32 | + |
| 33 | + protected function getEntityName(): string { |
| 34 | + return FundingApplicationProcessActivity::getEntityName(); |
| 35 | + } |
| 36 | + |
| 37 | + public function get(RemoteFundingGetAction $action): Result { |
| 38 | + $action->addClause('OR', |
| 39 | + ['activity_type_id', '=', ActivityTypeIds::FUNDING_APPLICATION_CREATE], |
| 40 | + ['activity_type_id', '=', ActivityTypeIds::FUNDING_APPLICATION_STATUS_CHANGE], |
| 41 | + ['activity_type_id', '=', ActivityTypeIds::FUNDING_APPLICATION_COMMENT_EXTERNAL], |
| 42 | + ['activity_type_id:name', '=', ActivityTypeNames::FUNDING_CLEARING_CREATE], |
| 43 | + ['activity_type_id:name', '=', ActivityTypeNames::FUNDING_CLEARING_STATUS_CHANGE], |
| 44 | + ); |
| 45 | + |
| 46 | + return parent::get($action); |
| 47 | + } |
| 48 | + |
| 49 | + protected function getParams(RemoteFundingGetAction $action): array { |
| 50 | + /** @var \Civi\Funding\Api4\Action\Remote\ApplicationProcessActivity\GetAction $action */ |
| 51 | + return ['applicationProcessId' => $action->getApplicationProcessId()] |
| 52 | + + parent::getParams($action); |
| 53 | + } |
| 54 | + |
| 55 | +} |
0 commit comments