From 4f3fe8eeb6bbb76252a7027c16a7ca8a072ddcfa Mon Sep 17 00:00:00 2001 From: Daniel Subiabre Date: Fri, 2 May 2025 12:26:25 +0200 Subject: [PATCH] Update MatchCallSubmission default status --- .../MatchCallSubmissionApiResource.php | 6 ++--- .../MatchCallSubmissionStatus.php | 5 ++++ .../MatchCallSubmissionStateProcessor.php | 26 +++++++++++++++++++ 3 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 src/State/Matchfunding/MatchCallSubmissionStateProcessor.php diff --git a/src/ApiResource/Matchfunding/MatchCallSubmissionApiResource.php b/src/ApiResource/Matchfunding/MatchCallSubmissionApiResource.php index 46ad425..31cf1d1 100644 --- a/src/ApiResource/Matchfunding/MatchCallSubmissionApiResource.php +++ b/src/ApiResource/Matchfunding/MatchCallSubmissionApiResource.php @@ -7,8 +7,8 @@ use ApiPlatform\Metadata as API; use App\ApiResource\Project\ProjectApiResource; use App\Entity\Matchfunding\MatchCallSubmission; use App\Entity\Matchfunding\MatchCallSubmissionStatus; -use App\State\ApiResourceStateProcessor; use App\State\ApiResourceStateProvider; +use App\State\Matchfunding\MatchCallSubmissionStateProcessor; /** * MatchCallSubmissions represent the will of a Project to be held under a MatchCall and receive matchfunding financement. @@ -17,7 +17,7 @@ use App\State\ApiResourceStateProvider; shortName: 'MatchCallSubmission', stateOptions: new Options(entityClass: MatchCallSubmission::class), provider: ApiResourceStateProvider::class, - processor: ApiResourceStateProcessor::class + processor: MatchCallSubmissionStateProcessor::class )] class MatchCallSubmissionApiResource { @@ -39,5 +39,5 @@ class MatchCallSubmissionApiResource * Only MatchCallSubmissions with an status `accepted` will receive matchfunding. */ #[API\ApiProperty(securityPostDenormalize: 'is_granted("MATCHCALLSUBMISSION_EDIT", object)')] - public MatchCallSubmissionStatus $status; + public MatchCallSubmissionStatus $status = MatchCallSubmissionStatus::ToReview; } diff --git a/src/Entity/Matchfunding/MatchCallSubmissionStatus.php b/src/Entity/Matchfunding/MatchCallSubmissionStatus.php index ce74d7c..5003fcc 100644 --- a/src/Entity/Matchfunding/MatchCallSubmissionStatus.php +++ b/src/Entity/Matchfunding/MatchCallSubmissionStatus.php @@ -4,6 +4,11 @@ namespace App\Entity\Matchfunding; enum MatchCallSubmissionStatus: string { + /** + * The MatchCallSubmission is pending review. + */ + case ToReview = 'to_review'; + /** * The MatchCallSubmission is under review for the MatchCall. */ diff --git a/src/State/Matchfunding/MatchCallSubmissionStateProcessor.php b/src/State/Matchfunding/MatchCallSubmissionStateProcessor.php new file mode 100644 index 0000000..dee0c74 --- /dev/null +++ b/src/State/Matchfunding/MatchCallSubmissionStateProcessor.php @@ -0,0 +1,26 @@ +autoMapper->map($data, MatchCallSubmission::class); + + dd($entity); + } +}