src/Entity/Core/Training/TrainingPerformance.php line 22

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