src/Entity/Core/Peer/PeerGroup.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Core\Peer;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Table('peer_group')]
  7. #[ORM\Entity]
  8. class PeerGroup
  9. {
  10. /**
  11. * @var int
  12. */
  13. #[ORM\Column(name: 'id', type: 'integer')]
  14. #[ORM\Id]
  15. #[ORM\GeneratedValue(strategy: 'AUTO')]
  16. private $id;
  17. #[ORM\Column(type: 'integer', nullable: true)]
  18. private $currentStage = 45;
  19. /**
  20. * @var PeerSession
  21. */
  22. #[ORM\JoinColumn(name: 'peer_session', referencedColumnName: 'id', onDelete: 'CASCADE')]
  23. #[ORM\ManyToOne(targetEntity: PeerSession::class, inversedBy: 'peerGroups')]
  24. private $peerSession;
  25. #[ORM\JoinColumn(name: 'peer_problem_id', nullable: true)]
  26. #[ORM\ManyToOne(targetEntity: PeerMathproblem::class)]
  27. private ?PeerMathproblem $peerProblem;
  28. #[ORM\OneToMany(targetEntity: PeerUnit::class, mappedBy: 'peerGroup', cascade: ['persist', 'remove'])]
  29. private Collection $peerUnits;
  30. /**
  31. * PeerGroup constructor.
  32. */
  33. public function __construct()
  34. {
  35. $this->peerUnits = new ArrayCollection();
  36. }
  37. public function getId(): int
  38. {
  39. return $this->id;
  40. }
  41. /**
  42. * @return mixed
  43. */
  44. public function getCurrentStage()
  45. {
  46. return $this->currentStage;
  47. }
  48. /**
  49. * @param mixed $currentStage
  50. */
  51. public function setCurrentStage($currentStage)
  52. {
  53. $this->currentStage = $currentStage;
  54. }
  55. public function getPeerSession(): PeerSession
  56. {
  57. return $this->peerSession;
  58. }
  59. public function setPeerSession(PeerSession $peerSession)
  60. {
  61. $this->peerSession = $peerSession;
  62. }
  63. /**
  64. * @return ArrayCollection | PeerUnit[]
  65. */
  66. public function getPeerUnits(): Collection
  67. {
  68. return $this->peerUnits;
  69. }
  70. public function addPeerUnit(PeerUnit $peerUnit)
  71. {
  72. $peerUnit->setPeerGroup($this);
  73. $this->peerUnits->add($peerUnit);
  74. }
  75. public function getPeerProblem(): ?PeerMathproblem
  76. {
  77. return $this->peerProblem;
  78. }
  79. public function setPeerProblem(PeerMathproblem $peerProblem): void
  80. {
  81. $this->peerProblem = $peerProblem;
  82. }
  83. }