From 9bf92d624579a3988bacd0cb67bb1f176fc5d020 Mon Sep 17 00:00:00 2001 From: Daniel Subiabre Date: Thu, 19 Dec 2024 12:52:04 +0100 Subject: [PATCH] Rename MatchSubmission to MatchCallSubmission --- .../Matchfunding/MatchCallApiResource.php | 10 +++--- ...php => MatchCallSubmissionApiResource.php} | 20 ++++++------ src/Entity/Matchfunding/MatchCall.php | 24 +++++++------- ...Submission.php => MatchCallSubmission.php} | 18 +++++------ .../MatchCallSubmissionStatus.php | 21 ++++++++++++ .../Matchfunding/MatchSubmissionStatus.php | 21 ------------ src/Entity/Project/Project.php | 32 +++++++++---------- .../MatchfundingTransactionsListener.php | 6 ++-- ....php => MatchCallSubmissionRepository.php} | 12 +++---- 9 files changed, 82 insertions(+), 82 deletions(-) rename src/ApiResource/Matchfunding/{MatchSubmissionApiResource.php => MatchCallSubmissionApiResource.php} (56%) rename src/Entity/Matchfunding/{MatchSubmission.php => MatchCallSubmission.php} (65%) create mode 100644 src/Entity/Matchfunding/MatchCallSubmissionStatus.php delete mode 100644 src/Entity/Matchfunding/MatchSubmissionStatus.php rename src/Repository/Matchfunding/{MatchSubmissionRepository.php => MatchCallSubmissionRepository.php} (69%) diff --git a/src/ApiResource/Matchfunding/MatchCallApiResource.php b/src/ApiResource/Matchfunding/MatchCallApiResource.php index cd63eb1..a5b688a 100644 --- a/src/ApiResource/Matchfunding/MatchCallApiResource.php +++ b/src/ApiResource/Matchfunding/MatchCallApiResource.php @@ -11,11 +11,11 @@ use App\State\ApiResourceStateProvider; /** - * A MatchCall is an owned and managed event which accepts MatchSubmissions from Projects to receive *matchfunding* financement. + * A MatchCall is an owned and managed event which accepts MatchCallSubmissions from Projects to receive *matchfunding* financement. * This means any money inside a Transaction going to a Project in a MatchCall will be matched with funds from the MatchCall accounting. * \ * \ - * MatchSubmissions from Projects can be accepted or rejected by the managers. + * MatchCallSubmissions from Projects can be accepted or rejected by the managers. * They can also choose from predefined strategies and tune them to perform the matching. */ #[API\ApiResource( @@ -44,9 +44,9 @@ class MatchCallApiResource public array $managers; /** - * A list of the MatchSubmissions received by this MatchCall. + * A list of the MatchCallSubmissions received by this MatchCall. * - * @var MatchSubmissionApiResource[] + * @var MatchCallSubmissionApiResource[] */ - public array $matchSubmissions; + public array $matchCallSubmissions; } diff --git a/src/ApiResource/Matchfunding/MatchSubmissionApiResource.php b/src/ApiResource/Matchfunding/MatchCallSubmissionApiResource.php similarity index 56% rename from src/ApiResource/Matchfunding/MatchSubmissionApiResource.php rename to src/ApiResource/Matchfunding/MatchCallSubmissionApiResource.php index b9a9327..3a6f8c8 100644 --- a/src/ApiResource/Matchfunding/MatchSubmissionApiResource.php +++ b/src/ApiResource/Matchfunding/MatchCallSubmissionApiResource.php @@ -5,27 +5,27 @@ use ApiPlatform\Doctrine\Orm\State\Options; use ApiPlatform\Metadata as API; use App\ApiResource\Project\ProjectApiResource; -use App\Entity\Matchfunding\MatchSubmission; -use App\Entity\Matchfunding\MatchSubmissionStatus; +use App\Entity\Matchfunding\MatchCallSubmission; +use App\Entity\Matchfunding\MatchCallSubmissionStatus; use App\State\ApiResourceStateProcessor; use App\State\ApiResourceStateProvider; /** - * MatchSubmissions represent the will of a Project to be held under a MatchCall and receive matchfunding financement. + * MatchCallSubmissions represent the will of a Project to be held under a MatchCall and receive matchfunding financement. */ #[API\ApiResource( - shortName: 'MatchSubmission', - stateOptions: new Options(entityClass: MatchSubmission::class), + shortName: 'MatchCallSubmission', + stateOptions: new Options(entityClass: MatchCallSubmission::class), provider: ApiResourceStateProvider::class, processor: ApiResourceStateProcessor::class )] -class MatchSubmissionApiResource +class MatchCallSubmissionApiResource { #[API\ApiProperty(identifier: true, writable: false)] public int $id; /** - * The MatchCall to which this MatchSubmission belongs to. + * The MatchCall to which this MatchCallSubmission belongs to. */ public MatchCallApiResource $matchCall; @@ -36,8 +36,8 @@ class MatchSubmissionApiResource /** * The status of the Project's application for the MatchCall.\ - * Only MatchSubmissions with an status `accepted` will receive matchfunding. + * Only MatchCallSubmissions with an status `accepted` will receive matchfunding. */ - #[API\ApiProperty(securityPostDenormalize: 'is_granted("MATCHSUBMISSION_EDIT", object)')] - public MatchSubmissionStatus $status; + #[API\ApiProperty(securityPostDenormalize: 'is_granted("MATCHCALLSUBMISSION_EDIT", object)')] + public MatchCallSubmissionStatus $status; } diff --git a/src/Entity/Matchfunding/MatchCall.php b/src/Entity/Matchfunding/MatchCall.php index dd770df..9545954 100644 --- a/src/Entity/Matchfunding/MatchCall.php +++ b/src/Entity/Matchfunding/MatchCall.php @@ -29,10 +29,10 @@ class MatchCall implements AccountingOwnerInterface private Collection $managers; /** - * @var Collection + * @var Collection */ - #[ORM\OneToMany(mappedBy: 'matchCall', targetEntity: MatchSubmission::class)] - private Collection $matchSubmissions; + #[ORM\OneToMany(mappedBy: 'matchCall', targetEntity: MatchCallSubmission::class)] + private Collection $matchCallSubmissions; #[ORM\Column(length: 255)] private ?string $strategyName = null; @@ -41,7 +41,7 @@ public function __construct() { $this->accounting = Accounting::of($this); $this->managers = new ArrayCollection(); - $this->matchSubmissions = new ArrayCollection(); + $this->matchCallSubmissions = new ArrayCollection(); } public function getId(): ?int @@ -86,26 +86,26 @@ public function removeManager(User $manager): static } /** - * @return Collection + * @return Collection */ - public function getMatchSubmissions(): Collection + public function getMatchCallSubmissions(): Collection { - return $this->matchSubmissions; + return $this->matchCallSubmissions; } - public function addMatchSubmission(MatchSubmission $submission): static + public function addMatchCallSubmission(MatchCallSubmission $submission): static { - if (!$this->matchSubmissions->contains($submission)) { - $this->matchSubmissions->add($submission); + if (!$this->matchCallSubmissions->contains($submission)) { + $this->matchCallSubmissions->add($submission); $submission->setMatchCall($this); } return $this; } - public function removeMatchSubmission(MatchSubmission $submission): static + public function removeMatchCallSubmission(MatchCallSubmission $submission): static { - if ($this->matchSubmissions->removeElement($submission)) { + if ($this->matchCallSubmissions->removeElement($submission)) { // set the owning side to null (unless already changed) if ($submission->getMatchCall() === $this) { $submission->setMatchCall(null); diff --git a/src/Entity/Matchfunding/MatchSubmission.php b/src/Entity/Matchfunding/MatchCallSubmission.php similarity index 65% rename from src/Entity/Matchfunding/MatchSubmission.php rename to src/Entity/Matchfunding/MatchCallSubmission.php index 2a913b2..8823119 100644 --- a/src/Entity/Matchfunding/MatchSubmission.php +++ b/src/Entity/Matchfunding/MatchCallSubmission.php @@ -3,27 +3,27 @@ namespace App\Entity\Matchfunding; use App\Entity\Project\Project; -use App\Repository\Matchfunding\MatchSubmissionRepository; +use App\Repository\Matchfunding\MatchCallSubmissionRepository; use Doctrine\ORM\Mapping as ORM; -#[ORM\Entity(repositoryClass: MatchSubmissionRepository::class)] -class MatchSubmission +#[ORM\Entity(repositoryClass: MatchCallSubmissionRepository::class)] +class MatchCallSubmission { #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] private ?int $id = null; - #[ORM\ManyToOne(inversedBy: 'matchSubmissions')] + #[ORM\ManyToOne(inversedBy: 'matchCallSubmissions')] #[ORM\JoinColumn(nullable: false)] private ?MatchCall $matchCall = null; - #[ORM\ManyToOne(inversedBy: 'matchSubmissions')] + #[ORM\ManyToOne(inversedBy: 'matchCallSubmissions')] #[ORM\JoinColumn(nullable: false)] private ?Project $project = null; - #[ORM\Column(enumType: MatchSubmissionStatus::class)] - private ?MatchSubmissionStatus $status = null; + #[ORM\Column(enumType: MatchCallSubmissionStatus::class)] + private ?MatchCallSubmissionStatus $status = null; public function getId(): ?int { @@ -54,12 +54,12 @@ public function setProject(?Project $project): static return $this; } - public function getStatus(): ?MatchSubmissionStatus + public function getStatus(): ?MatchCallSubmissionStatus { return $this->status; } - public function setStatus(MatchSubmissionStatus $status): static + public function setStatus(MatchCallSubmissionStatus $status): static { $this->status = $status; diff --git a/src/Entity/Matchfunding/MatchCallSubmissionStatus.php b/src/Entity/Matchfunding/MatchCallSubmissionStatus.php new file mode 100644 index 0000000..ce74d7c --- /dev/null +++ b/src/Entity/Matchfunding/MatchCallSubmissionStatus.php @@ -0,0 +1,21 @@ + + * @var Collection */ - #[ORM\OneToMany(mappedBy: 'project', targetEntity: MatchSubmission::class)] - private Collection $matchSubmissions; + #[ORM\OneToMany(mappedBy: 'project', targetEntity: MatchCallSubmission::class)] + private Collection $matchCallSubmissions; public function __construct() { $this->accounting = Accounting::of($this); $this->rewards = new ArrayCollection(); - $this->matchSubmissions = new ArrayCollection(); + $this->matchCallSubmissions = new ArrayCollection(); } public function getId(): ?int @@ -169,29 +169,29 @@ public function removeReward(Reward $reward): static } /** - * @return Collection + * @return Collection */ - public function getMatchSubmissions(): Collection + public function getMatchCallSubmissions(): Collection { - return $this->matchSubmissions; + return $this->matchCallSubmissions; } - public function addMatchSubmission(MatchSubmission $matchSubmission): static + public function addMatchCallSubmission(MatchCallSubmission $MatchCallSubmission): static { - if (!$this->matchSubmissions->contains($matchSubmission)) { - $this->matchSubmissions->add($matchSubmission); - $matchSubmission->setProject($this); + if (!$this->matchCallSubmissions->contains($MatchCallSubmission)) { + $this->matchCallSubmissions->add($MatchCallSubmission); + $MatchCallSubmission->setProject($this); } return $this; } - public function removeMatchSubmission(MatchSubmission $matchSubmission): static + public function removeMatchCallSubmission(MatchCallSubmission $MatchCallSubmission): static { - if ($this->matchSubmissions->removeElement($matchSubmission)) { + if ($this->matchCallSubmissions->removeElement($MatchCallSubmission)) { // set the owning side to null (unless already changed) - if ($matchSubmission->getProject() === $this) { - $matchSubmission->setProject(null); + if ($MatchCallSubmission->getProject() === $this) { + $MatchCallSubmission->setProject(null); } } diff --git a/src/EventListener/MatchfundingTransactionsListener.php b/src/EventListener/MatchfundingTransactionsListener.php index a9c2570..fd9d3f1 100644 --- a/src/EventListener/MatchfundingTransactionsListener.php +++ b/src/EventListener/MatchfundingTransactionsListener.php @@ -3,7 +3,7 @@ namespace App\EventListener; use App\Entity\Accounting\Transaction; -use App\Entity\Matchfunding\MatchSubmissionStatus; +use App\Entity\Matchfunding\MatchCallSubmissionStatus; use App\Entity\Project\Project; use App\Matchfunding\MatchStrategy\MatchStrategyLocator; use Doctrine\Bundle\DoctrineBundle\Attribute\AsEntityListener; @@ -34,10 +34,10 @@ public function processTransaction( return; } - $submissions = $target->getMatchSubmissions(); + $submissions = $target->getMatchCallSubmissions(); foreach ($submissions as $submission) { - if ($submission->getStatus() !== MatchSubmissionStatus::Accepted) { + if ($submission->getStatus() !== MatchCallSubmissionStatus::Accepted) { continue; } diff --git a/src/Repository/Matchfunding/MatchSubmissionRepository.php b/src/Repository/Matchfunding/MatchCallSubmissionRepository.php similarity index 69% rename from src/Repository/Matchfunding/MatchSubmissionRepository.php rename to src/Repository/Matchfunding/MatchCallSubmissionRepository.php index 35eb4f4..54b8646 100644 --- a/src/Repository/Matchfunding/MatchSubmissionRepository.php +++ b/src/Repository/Matchfunding/MatchCallSubmissionRepository.php @@ -2,22 +2,22 @@ namespace App\Repository\Matchfunding; -use App\Entity\Matchfunding\MatchSubmission; +use App\Entity\Matchfunding\MatchCallSubmission; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Persistence\ManagerRegistry; /** - * @extends ServiceEntityRepository + * @extends ServiceEntityRepository */ -class MatchSubmissionRepository extends ServiceEntityRepository +class MatchCallSubmissionRepository extends ServiceEntityRepository { public function __construct(ManagerRegistry $registry) { - parent::__construct($registry, MatchSubmission::class); + parent::__construct($registry, MatchCallSubmission::class); } // /** - // * @return MatchSubmission[] Returns an array of MatchSubmission objects + // * @return MatchCallSubmission[] Returns an array of MatchCallSubmission objects // */ // public function findByExampleField($value): array // { @@ -31,7 +31,7 @@ public function __construct(ManagerRegistry $registry) // ; // } - // public function findOneBySomeField($value): ?MatchSubmission + // public function findOneBySomeField($value): ?MatchCallSubmission // { // return $this->createQueryBuilder('m') // ->andWhere('m.exampleField = :val')