src/CoreBundle/Entity/StudentTopic.php line 13

Open in your IDE?
  1. <?php
  2. namespace CoreBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use FOS\UserBundle\Model\UserInterface;
  5. use UserBundle\Entity\User;
  6. /**
  7. * @ORM\Table("student_topic")
  8. * @ORM\Entity(repositoryClass="CoreBundle\Repository\StudentTopic")
  9. */
  10. class StudentTopic
  11. {
  12. /**
  13. * @ORM\Column(name="id", type="integer")
  14. * @ORM\Id
  15. * @ORM\GeneratedValue(strategy="AUTO")
  16. */
  17. private $id;
  18. /**
  19. * @ORM\ManyToOne(targetEntity="UserBundle\Entity\User")
  20. * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
  21. */
  22. private $user;
  23. /**
  24. * @ORM\Column(name="topic_cnt", type="integer")
  25. */
  26. private $topicCnt;
  27. public function __construct(User $user, int $topicCnt)
  28. {
  29. $this->user = $user;
  30. $this->topicCnt = $topicCnt;
  31. }
  32. public function getId()
  33. {
  34. return $this->id;
  35. }
  36. public function setUser(UserInterface $user)
  37. {
  38. $this->user = $user;
  39. }
  40. public function getUser()
  41. {
  42. return $this->user;
  43. }
  44. /**
  45. * @return mixed
  46. */
  47. public function getTopicCnt()
  48. {
  49. return $this->topicCnt;
  50. }
  51. /**
  52. * @param mixed $topicCnt
  53. */
  54. public function setTopicCnt($topicCnt): void
  55. {
  56. $this->topicCnt = $topicCnt;
  57. }
  58. public function increaseTopicCnt(): void
  59. {
  60. $this->topicCnt = $this->topicCnt + 1;
  61. }
  62. public function resetTopicCnt(): void
  63. {
  64. $this->topicCnt = 1;
  65. }
  66. }