Update MatchCallSubmission default status

This commit is contained in:
2025-05-02 12:26:25 +02:00
parent c3cb7cd494
commit 4f3fe8eeb6
3 changed files with 34 additions and 3 deletions
@@ -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;
}
@@ -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.
*/
@@ -0,0 +1,26 @@
<?php
namespace App\State\Matchfunding;
use ApiPlatform\Metadata\Operation;
use ApiPlatform\State\ProcessorInterface;
use App\ApiResource\Matchfunding\MatchCallSubmissionApiResource;
use App\Entity\Matchfunding\MatchCallSubmission;
use App\Mapping\AutoMapper;
class MatchCallSubmissionStateProcessor implements ProcessorInterface
{
public function __construct(
private AutoMapper $autoMapper
) {}
/**
* @param MatchCallSubmissionApiResource $data
*/
public function process(mixed $data, Operation $operation, array $uriVariables = [], array $context = [])
{
$entity = $this->autoMapper->map($data, MatchCallSubmission::class);
dd($entity);
}
}