src/Entity/ChannelUserData/Cursus/AbstractCursusProgression.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity\ChannelUserData\Cursus;
  3. use App\Repository\ChannelUserData\Cursus\AbstractCursusProgressionRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use DrosalysWeb\ObjectExtensions\Timestamp\Model\TimestampInterface;
  6. use DrosalysWeb\ObjectExtensions\Timestamp\Model\TimestampTrait;
  7. use DrosalysWeb\ObjectExtensions\Timestamp\Model\UpdatedTimestampInterface;
  8. use DrosalysWeb\ObjectExtensions\Timestamp\Model\UpdateTimestampTrait;
  9. use Symfony\Component\Serializer\Annotation as Serial;
  10. #[
  11. ORM\Entity(repositoryClass: AbstractCursusProgressionRepository::class),
  12. ORM\Table(name: 'channel_user_data_cursus_progress'),
  13. ]
  14. class AbstractCursusProgression implements TimestampInterface
  15. {
  16. use TimestampTrait;
  17. #[ORM\Id, ORM\GeneratedValue, ORM\Column(type: 'integer')]
  18. private ?int $id = null;
  19. #[ORM\OneToOne(mappedBy: 'cursusProgression', targetEntity: AbstractCursus::class)]
  20. private ?AbstractCursus $cursus = null;
  21. #[ORM\Column(type: 'integer', nullable: true)]
  22. #[Serial\Groups(groups: ['Async'])]
  23. private ?int $eLearningPercentage = null;
  24. #[ORM\Column(type: 'integer', nullable: true)]
  25. #[Serial\Groups(groups: ['Async'])]
  26. private ?int $eventsPercentage = null;
  27. #[ORM\Column(type: 'integer', nullable: true)]
  28. #[Serial\Groups(groups: ['Async'])]
  29. private ?int $totalPercentage = null;
  30. #[ORM\Column(type: 'integer', nullable: true)]
  31. #[Serial\Groups(groups: ['Async'])]
  32. private ?int $eLearningTotalTime = null;
  33. #[ORM\Column(type: 'integer', nullable: true)]
  34. #[Serial\Groups(groups: ['Async'])]
  35. private ?int $eventTotalTime = null;
  36. #[Serial\Groups(groups: ['Async'])]
  37. public function getTotalTime(): int
  38. {
  39. return ($this->getEventTotalTime() ?? 0) + ($this->getELearningTotalTime() ?? 0);
  40. }
  41. public function getId(): ?int
  42. {
  43. return $this->id;
  44. }
  45. public function getCursus(): ?AbstractCursus
  46. {
  47. return $this->cursus;
  48. }
  49. public function setCursus(?AbstractCursus $cursus): AbstractCursusProgression
  50. {
  51. $this->cursus = $cursus;
  52. $this->cursus->setCursusProgression($this);
  53. return $this;
  54. }
  55. public function getELearningPercentage(): ?int
  56. {
  57. return $this->eLearningPercentage;
  58. }
  59. public function setELearningPercentage(?int $eLearningPercentage): AbstractCursusProgression
  60. {
  61. $this->eLearningPercentage = $eLearningPercentage;
  62. return $this;
  63. }
  64. public function getEventsPercentage(): ?int
  65. {
  66. return $this->eventsPercentage;
  67. }
  68. public function setEventsPercentage(?int $eventsPercentage): AbstractCursusProgression
  69. {
  70. $this->eventsPercentage = $eventsPercentage;
  71. return $this;
  72. }
  73. public function getTotalPercentage(): ?int
  74. {
  75. return $this->totalPercentage;
  76. }
  77. public function setTotalPercentage(?int $totalPercentage): AbstractCursusProgression
  78. {
  79. $this->totalPercentage = $totalPercentage;
  80. return $this;
  81. }
  82. public function getELearningTotalTime(): ?int
  83. {
  84. return $this->eLearningTotalTime;
  85. }
  86. public function setELearningTotalTime(?int $eLearningTotalTime): AbstractCursusProgression
  87. {
  88. $this->eLearningTotalTime = $eLearningTotalTime;
  89. return $this;
  90. }
  91. public function getEventTotalTime(): ?int
  92. {
  93. return $this->eventTotalTime;
  94. }
  95. public function setEventTotalTime(?int $eventTotalTime): AbstractCursusProgression
  96. {
  97. $this->eventTotalTime = $eventTotalTime;
  98. return $this;
  99. }
  100. }