<?php
namespace CoreBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use FOS\UserBundle\Model\UserInterface;
use UserBundle\Entity\User;
/**
* @ORM\Table("student_topic")
* @ORM\Entity(repositoryClass="CoreBundle\Repository\StudentTopic")
*/
class StudentTopic
{
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity="UserBundle\Entity\User")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
*/
private $user;
/**
* @ORM\Column(name="topic_cnt", type="integer")
*/
private $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;
}
}