<?php
namespace App\Entity\Core\Training;
use App\Entity\Core\Topic\TopicPerformance;
use Doctrine\ORM\Mapping\InverseJoinColumn;
use App\Entity\Core\Session\Session;
use App\Entity\Core\SessionTypePerformance;
use App\Entity\User\User;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\JoinColumn;
use Doctrine\ORM\Mapping\JoinTable;
use Doctrine\ORM\Mapping\ManyToMany;
use Doctrine\ORM\Mapping\ManyToOne;
use Doctrine\ORM\PersistentCollection;
#[ORM\Table('training_performance')]
#[ORM\Entity(repositoryClass: TrainingPerformanceRepository::class)]
class TrainingPerformance extends SessionTypePerformance
{
#[ManyToOne(targetEntity: Session::class)]
private $session;
#[JoinTable(name: 'training_performance_topic_performance')]
#[JoinColumn(name: 'training_performance_id')]
#[InverseJoinColumn(name: 'topic_performance_id', unique: true)]
#[ManyToMany(targetEntity: TopicPerformance::class)]
private $topicPerformances;
public function __construct(User $student, Session $session)
{
parent::__construct($student);
$this->session = $session;
$this->topicPerformances = new ArrayCollection();
}
/** @return PersistentCollection | ArrayCollection */
public function getTopicPerformances(): Collection
{
return $this->topicPerformances;
}
public function setTopicPerformances(ArrayCollection $topicPerformances): void
{
$this->topicPerformances = $topicPerformances;
}
}