<?php
declare(strict_types=1);
namespace App\Entity\Core;
use Doctrine\ORM\Mapping as ORM;
use App\Entity\User\User;
use Symfony\Component\Security\Core\User\UserInterface;
#[ORM\Table('student_topic')]
#[ORM\Entity(repositoryClass: \App\Repository\Core\StudentTopic::class)]
class StudentTopic
{
#[ORM\Column(name: 'id', type: 'integer')]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private int $id;
#[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id')]
#[ORM\ManyToOne(targetEntity: User::class)]
private UserInterface $user;
#[ORM\Column(name: 'topic_cnt', type: 'integer')]
private int $topicCnt;
public function __construct(User $user, int $topicCnt)
{
$this->user = $user;
$this->topicCnt = $topicCnt;
}
public function getId()
{
return $this->id;
}
public function setUser(UserInterface $user)
{
$this->user = $user;
}
public function getUser()
{
return $this->user;
}
/**
* @return mixed
*/
public function getTopicCnt()
{
return $this->topicCnt;
}
/**
* @param mixed $topicCnt
*/
public function setTopicCnt($topicCnt): void
{
$this->topicCnt = $topicCnt;
}
public function increaseTopicCnt(): void
{
$this->topicCnt = $this->topicCnt + 1;
}
public function resetTopicCnt(): void
{
$this->topicCnt = 1;
}
}