WIP: Implement feedback functionality

This commit is contained in:
Björn Fromme
2023-11-02 18:01:12 +01:00
parent 2689f93683
commit 2599fd69dc
28 changed files with 640 additions and 43 deletions
+34
View File
@@ -84,6 +84,9 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa
#[ORM\ManyToOne]
private ?User $owner = null;
#[ORM\OneToMany(mappedBy: 'assignment', targetEntity: Feedback::class)]
private Collection $feedbacks;
public function __construct()
{
$this->uuid = Uuid::v4();
@@ -93,6 +96,7 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa
$this->teamers = new ArrayCollection();
$this->benefits = "Anreise im E&P Reisebus\nUnterkunft\nVerpflegung\nSkipass\n";
$this->documents = new ArrayCollection();
$this->feedbacks = new ArrayCollection();
}
public static function duplicate(Assignment $assignment): static
@@ -436,4 +440,34 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa
return $this;
}
/**
* @return Collection<int, Feedback>
*/
public function getFeedbacks(): Collection
{
return $this->feedbacks;
}
public function addFeedback(Feedback $feedback): static
{
if (!$this->feedbacks->contains($feedback)) {
$this->feedbacks->add($feedback);
$feedback->setAssignment($this);
}
return $this;
}
public function removeFeedback(Feedback $feedback): static
{
if ($this->feedbacks->removeElement($feedback)) {
// set the owning side to null (unless already changed)
if ($feedback->getAssignment() === $this) {
$feedback->setAssignment(null);
}
}
return $this;
}
}