WIP: Implement feedback functionality
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user