src/Entity/Core/Homework/HomeworkPerformance.php line 21

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Core\Homework;
  3. use App\Entity\Core\Topic\TopicPerformance;
  4. use Doctrine\ORM\Mapping\InverseJoinColumn;
  5. use App\Entity\Core\SessionTypePerformance;
  6. use App\Entity\User\User;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use Doctrine\ORM\Mapping\JoinColumn;
  11. use Doctrine\ORM\Mapping\JoinTable;
  12. use Doctrine\ORM\Mapping\ManyToMany;
  13. use Doctrine\ORM\Mapping\ManyToOne;
  14. use Doctrine\ORM\PersistentCollection;
  15. #[ORM\Table('homework_performance')]
  16. #[ORM\Entity(repositoryClass: HomeworkPerformanceRepository::class)]
  17. class HomeworkPerformance extends SessionTypePerformance
  18. {
  19. #[ManyToOne(targetEntity: Homework::class)]
  20. private $session;
  21. #[JoinTable(name: 'homework_performance_topic_performance')]
  22. #[JoinColumn(name: 'homework_performance_id')]
  23. #[InverseJoinColumn(name: 'topic_performance_id', unique: true)]
  24. #[ManyToMany(targetEntity: TopicPerformance::class)]
  25. private $topicPerformances;
  26. public function __construct(User $student, Homework $session)
  27. {
  28. parent::__construct($student);
  29. $this->session = $session;
  30. $this->topicPerformances = new ArrayCollection();
  31. }
  32. /** @return PersistentCollection | ArrayCollection */
  33. public function getTopicPerformances(): Collection
  34. {
  35. return $this->topicPerformances;
  36. }
  37. public function setTopicPerformances(ArrayCollection $topicPerformances): void
  38. {
  39. $this->topicPerformances = $topicPerformances;
  40. }
  41. }