WIP: Implement feedback functionality
This commit is contained in:
@@ -84,9 +84,6 @@ 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();
|
||||
@@ -96,7 +93,6 @@ 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
|
||||
@@ -440,34 +436,4 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,9 @@ class Disposition implements BlameableEntityInterface, TimestampableEntityInterf
|
||||
#[ORM\OneToMany(mappedBy: 'disposition', targetEntity: Upload::class, cascade: ['persist', 'remove'])]
|
||||
private Collection $documents;
|
||||
|
||||
#[ORM\OneToOne(cascade: ['persist', 'remove'])]
|
||||
private ?Feedback $feedback = null;
|
||||
|
||||
public function __construct(Application $application)
|
||||
{
|
||||
$this->uuid = Uuid::v4();
|
||||
@@ -155,4 +158,16 @@ class Disposition implements BlameableEntityInterface, TimestampableEntityInterf
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getFeedback(): ?Feedback
|
||||
{
|
||||
return $this->feedback;
|
||||
}
|
||||
|
||||
public function setFeedback(?Feedback $feedback): static
|
||||
{
|
||||
$this->feedback = $feedback;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,10 +26,6 @@ class Feedback implements BlameableEntityInterface, TimestampableEntityInterface
|
||||
#[ORM\ManyToOne(inversedBy: 'feedback')]
|
||||
private ?Teamer $teamer = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'feedbacks')]
|
||||
#[ORM\JoinColumn(onDelete: 'SET NULL')]
|
||||
private ?Assignment $assignment = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $assignmentDestination = null;
|
||||
|
||||
@@ -66,18 +62,6 @@ class Feedback implements BlameableEntityInterface, TimestampableEntityInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAssignment(): ?Assignment
|
||||
{
|
||||
return $this->assignment;
|
||||
}
|
||||
|
||||
public function setAssignment(?Assignment $assignment): static
|
||||
{
|
||||
$this->assignment = $assignment;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAssignmentDestination(): ?string
|
||||
{
|
||||
return $this->assignmentDestination;
|
||||
|
||||
@@ -2,14 +2,16 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Entity\Traits\BlameableEntity;
|
||||
use App\Entity\Traits\TimestampableEntity;
|
||||
use App\Repository\FeedbackSetRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
#[ORM\Entity(repositoryClass: FeedbackSetRepository::class)]
|
||||
class FeedbackSet implements TimestampableEntityInterface
|
||||
class FeedbackSet implements BlameableEntityInterface, TimestampableEntityInterface
|
||||
{
|
||||
use BlameableEntity;
|
||||
use TimestampableEntity;
|
||||
|
||||
#[ORM\Id]
|
||||
@@ -23,7 +25,7 @@ class FeedbackSet implements TimestampableEntityInterface
|
||||
|
||||
#[ORM\Column]
|
||||
#[Assert\Count(min: 1, minMessage: 'Bitte füge mindestens eine Bewertung hinzu')]
|
||||
private array $items = [];
|
||||
private array $ratings = [];
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
@@ -42,14 +44,14 @@ class FeedbackSet implements TimestampableEntityInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getItems(): array
|
||||
public function getRatings(): array
|
||||
{
|
||||
return $this->items;
|
||||
return $this->ratings;
|
||||
}
|
||||
|
||||
public function setItems(array $items): static
|
||||
public function setRatings(array $ratings): static
|
||||
{
|
||||
$this->items = $items;
|
||||
$this->ratings = $ratings;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ class JobProfile implements BlameableEntityInterface, TimestampableEntityInterfa
|
||||
|
||||
#[ORM\ManyToOne]
|
||||
#[ORM\JoinColumn(onDelete: 'SET NULL')]
|
||||
#[Assert\NotNull(message: 'Bitte ordne eine Feedback-Vorlage zu')]
|
||||
private ?FeedbackSet $feedbackSet = null;
|
||||
|
||||
public function __construct()
|
||||
|
||||
Reference in New Issue
Block a user