Skip to content

Commit

Permalink
Rename MatchSubmission to MatchCallSubmission
Browse files Browse the repository at this point in the history
  • Loading branch information
subiabre committed Dec 19, 2024
1 parent 71432d9 commit 9bf92d6
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 82 deletions.
10 changes: 5 additions & 5 deletions src/ApiResource/Matchfunding/MatchCallApiResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
}
24 changes: 12 additions & 12 deletions src/Entity/Matchfunding/MatchCall.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ class MatchCall implements AccountingOwnerInterface
private Collection $managers;

/**
* @var Collection<int, MatchSubmission>
* @var Collection<int, MatchCallSubmission>
*/
#[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;
Expand All @@ -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
Expand Down Expand Up @@ -86,26 +86,26 @@ public function removeManager(User $manager): static
}

/**
* @return Collection<int, MatchSubmission>
* @return Collection<int, MatchCallSubmission>
*/
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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;

Expand Down
21 changes: 21 additions & 0 deletions src/Entity/Matchfunding/MatchCallSubmissionStatus.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace App\Entity\Matchfunding;

enum MatchCallSubmissionStatus: string
{
/**
* The MatchCallSubmission is under review for the MatchCall.
*/
case InReview = 'in_review';

/**
* The MatchCallSubmission was accepted into the MatchCall.
*/
case Accepted = 'accepted';

/**
* The MatchCallSubmission was rejected out of the MatchCall.
*/
case Rejected = 'rejected';
}
21 changes: 0 additions & 21 deletions src/Entity/Matchfunding/MatchSubmissionStatus.php

This file was deleted.

32 changes: 16 additions & 16 deletions src/Entity/Project/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use App\Entity\Accounting\Accounting;
use App\Entity\Interface\AccountingOwnerInterface;
use App\Entity\Interface\UserOwnedInterface;
use App\Entity\Matchfunding\MatchSubmission;
use App\Entity\Matchfunding\MatchCallSubmission;
use App\Entity\Trait\MigratedEntity;
use App\Entity\Trait\TimestampedCreationEntity;
use App\Entity\Trait\TimestampedUpdationEntity;
Expand Down Expand Up @@ -61,16 +61,16 @@ class Project implements UserOwnedInterface, AccountingOwnerInterface
private Collection $rewards;

/**
* @var Collection<int, MatchSubmission>
* @var Collection<int, MatchCallSubmission>
*/
#[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
Expand Down Expand Up @@ -169,29 +169,29 @@ public function removeReward(Reward $reward): static
}

/**
* @return Collection<int, MatchSubmission>
* @return Collection<int, MatchCallSubmission>
*/
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);
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/EventListener/MatchfundingTransactionsListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<MatchSubmission>
* @extends ServiceEntityRepository<MatchCallSubmission>
*/
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
// {
Expand All @@ -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')
Expand Down

0 comments on commit 9bf92d6

Please sign in to comment.