src/CoreBundle/Entity/PeerStudent.php line 14

Open in your IDE?
  1. <?php
  2. namespace CoreBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use JsonSerializable;
  5. use UserBundle\Entity\User;
  6. /**
  7. * @ORM\Table("peer_student")
  8. * @ORM\Entity
  9. */
  10. class PeerStudent implements JsonSerializable
  11. {
  12. /**
  13. * @ORM\Column(name="id", type="integer")
  14. * @ORM\Id
  15. * @ORM\GeneratedValue(strategy="AUTO")
  16. */
  17. private int $id;
  18. /**
  19. * @ORM\Column(name="is_team_leader", type="boolean", options={"default":false})
  20. */
  21. private bool $isTeamLeader;
  22. /**
  23. * @ORM\ManyToOne(targetEntity="PeerUnit", inversedBy="peerStudents")
  24. * @ORM\JoinColumn(name="PeerUnit", referencedColumnName="id", onDelete="CASCADE")
  25. */
  26. private PeerUnit $peerUnit;
  27. /**
  28. * @ORM\ManyToOne(targetEntity="UserBundle\Entity\User")
  29. * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
  30. */
  31. private User $student;
  32. /**
  33. * @ORM\Column(name="confirmedCooperation", type="boolean");
  34. */
  35. private bool $confirmedCooperation = false;
  36. public function setConfirmedCooperation(bool $confirmedCooperation): PeerStudent
  37. {
  38. $this->confirmedCooperation = $confirmedCooperation;
  39. return $this;
  40. }
  41. public function getConfirmedCooperation(): bool
  42. {
  43. return $this->confirmedCooperation;
  44. }
  45. public function getId(): int
  46. {
  47. return $this->id;
  48. }
  49. public function setPeerUnit(PeerUnit $peerUnit): PeerStudent
  50. {
  51. $this->peerUnit = $peerUnit;
  52. return $this;
  53. }
  54. public function getPeerUnit(): PeerUnit
  55. {
  56. return $this->peerUnit;
  57. }
  58. public function setStudent(User $student): PeerStudent
  59. {
  60. $this->student = $student;
  61. return $this;
  62. }
  63. public function getStudent(): User
  64. {
  65. return $this->student;
  66. }
  67. public function setIsTeamLeader(bool $isTeamLeader): PeerStudent
  68. {
  69. $this->isTeamLeader = $isTeamLeader;
  70. return $this;
  71. }
  72. public function getIsTeamLeader(): bool
  73. {
  74. return $this->isTeamLeader;
  75. }
  76. public function jsonSerialize(): mixed
  77. {
  78. return [
  79. "id" => $this->id,
  80. "isTeamLeader" => $this->isTeamLeader,
  81. "studentName" => $this->getStudent()->getFullName(),
  82. ];
  83. }
  84. }