src/Entity/ChannelUserData/Cursus/AbstractCursus.php line 71

Open in your IDE?
  1. <?php
  2. namespace App\Entity\ChannelUserData\Cursus;
  3. use App\Entity\Account\User;
  4. use App\Entity\Channel\ChannelLicencesResourceInterface;
  5. use App\Entity\Channel\ChannelUserCursusPermission;
  6. use App\Entity\Channel\Organization;
  7. use App\Entity\Channel\Place;
  8. use App\Entity\Channel\Training;
  9. use App\Entity\ChannelUserData\Activity\ActivityFeed;
  10. use App\Entity\ChannelUserData\ChannelUserData;
  11. use App\Entity\Common\ImportableData\ImportableDataInterface;
  12. use App\Entity\Common\ImportableData\ImportableDataTrait;
  13. use App\Entity\Sync\SyncableInterface;
  14. use App\Enum\ChannelUserData\Activity\CursusActivityTagEnum;
  15. use App\Enum\ChannelUserData\CursusFoundingStatusEnum;
  16. use App\Enum\ChannelUserData\CursusInternshipStatus;
  17. use App\Enum\ChannelUserData\CursusStoppedStatusEnum;
  18. use App\Enum\ChannelUserData\ExamStatusEnum;
  19. use App\Repository\ChannelUserData\Cursus\AbstractCursusRepository;
  20. use App\Validator\Constraints as AppAssert;
  21. use App\Validator\Constraints\AbstractCursusConstraint;
  22. use App\Validator\Constraints\ChannelLicensesConstraint;
  23. use DateTimeInterface;
  24. use Doctrine\Common\Collections\ArrayCollection;
  25. use Doctrine\Common\Collections\Collection;
  26. use Doctrine\ORM\Mapping as ORM;
  27. use Drosalys\Bundle\ApiBundle\Serializer\Attributes\IdGroups;
  28. use Nellapp\Bundle\SDKBundle\Auth\Entity\UserInterface;
  29. use Nellapp\Bundle\SDKBundle\Channel\Entity\ChannelInterface;
  30. use Nellapp\Bundle\SDKBundle\Channel\Entity\Cursus\AbstractCursusInterface;
  31. use Nellapp\Bundle\SDKBundle\Channel\Entity\Cursus\AbstractCursusMethodTrait;
  32. use Nellapp\Bundle\SDKBundle\Enum\ChannelUserData\CursusCourseEnum;
  33. use Nellapp\Bundle\SDKBundle\Enum\ChannelUserData\CursusModalityEnum;
  34. use Nellapp\Bundle\SDKBundle\Permission\Entity\ChannelResourceInterface;
  35. use Nellapp\Bundle\SDKBundle\Permission\UserOwner\UserOwnerResourceInterface;
  36. use Nellapp\Bundle\SDKBundle\Permission\UsersResource\UsersResourceInterface;
  37. use Nellapp\Bundle\SDKBundle\Sync\EntityKeys;
  38. use Nellapp\Bundle\SDKBundle\TrackData\Attribute\TrackEntity;
  39. use Nellapp\Bundle\SDKBundle\TrackData\Attribute\TrackFIeld;
  40. use Nellapp\Bundle\SDKBundle\Utils\NellappFormatService;
  41. use Symfony\Component\Serializer\Annotation as Serial;
  42. use Symfony\Component\Validator\Constraints as Assert;
  43. #[
  44.     ORM\Entity(repositoryClassAbstractCursusRepository::class),
  45.     ORM\Table(name'channel_user_data_cursus'),
  46.     ORM\InheritanceType('JOINED'),
  47.     ORM\DiscriminatorColumn(name'type'type'string'),
  48.     ORM\DiscriminatorMap(['session-type' => SessionCursus::class, 'training-type' => TrainingCursus::class]),
  49.     AbstractCursusConstraint(message'abstract_cursus.abstract_cursus_constraint.message'),
  50.     TrackEntity(
  51.         fieldGroups: [
  52.             'progress' => [
  53.                 'tags' => [CursusActivityTagEnum::PROGRESSION],
  54.             ],
  55.             'internship' => [
  56.                 'tags' => [CursusActivityTagEnum::INTERNSHIP],
  57.             ],
  58.             'founding' => [
  59.                 'tags' => [CursusActivityTagEnum::FOUNDING]
  60.             ],
  61.             'exam' => [
  62.                 'tags' => [CursusActivityTagEnum::EXAM],
  63.             ]
  64.         ]
  65.     ),
  66.     ChannelLicensesConstraint
  67. ]
  68. abstract class AbstractCursus implements AbstractCursusInterfaceSyncableInterfaceChannelLicencesResourceInterfaceChannelResourceInterfaceImportableDataInterfaceUserOwnerResourceInterfaceUsersResourceInterface
  69. {
  70.     use AbstractCursusMethodTrait;
  71.     use ImportableDataTrait;
  72.     #[ORM\IdORM\GeneratedValueORM\Column(type'integer')]
  73.     #[Serial\Groups(['Sync''GlobalJSVariable'])]
  74.     private ?int $id null;
  75.     #[ORM\ManyToOne(targetEntityChannelUserData::class, cascade: ['persist'], inversedBy'cursuses')]
  76.     #[ORM\JoinColumn(nullablefalseonDelete'CASCADE')]
  77.     #[IdGroups(['Sync'])]
  78.     #[Assert\NotBlank]
  79.     private ?ChannelUserData $channelUserData null;
  80.     #[
  81.         ORM\ManyToOne(targetEntityTraining::class),
  82.         ORM\JoinColumn(nullabletrueonDelete'SET NULL')
  83.     ]
  84.     #[IdGroups(['Sync'])]
  85.     private ?Training $training null;
  86.     #[ORM\Column(type'datetime')]
  87.     #[Serial\Groups(['Sync'])]
  88.     #[Assert\NotBlank(groups: ['CursusProgress'])]
  89.     #[TrackFIeld(name'cursus.entity.startAt.label'fieldKey'progress', callable: 'format'callableParams: ['d/m/Y'])]
  90.     private ?DateTimeInterface $startAt null;
  91.     #[ORM\Column(type'datetime')]
  92.     #[Serial\Groups(['Sync'])]
  93.     #[
  94.         Assert\GreaterThanOrEqual(propertyPath'startAt'message'abstract_cursus.endAt.GreaterThan'groups: ['CursusProgress''Default']),
  95.         AppAssert\DateWithinIntervalOf(reference'startAt'maxInterval'P5Y'message'abstract_cursus.endAt.MaxDate'groups: ['CursusProgress''Default']),
  96.         Assert\NotBlank(groups: ['CursusProgress'])
  97.     ]
  98.     #[TrackFIeld(name'cursus.entity.endAt.label'fieldKey'progress', callable: 'format'callableParams: ['d/m/Y'])]
  99.     private ?DateTimeInterface $endAt null;
  100.     #[ORM\Column(type'integer'nullabletrue)]
  101.     #[
  102.         Assert\Type(type'integer'groups: ['CursusProgress']),
  103.         Assert\GreaterThanOrEqual(value1),
  104.         Assert\LessThanOrEqual(value24)
  105.     ]
  106.     #[TrackFIeld(name'cursus.entity.monthDuration.label'fieldKey'progress')]
  107.     private ?int $monthDuration null;
  108.     #[ORM\OneToOne(inversedBy'cursus'targetEntityAbstractCursusProgression::class, cascade: ['persist''remove'], orphanRemovaltrue)]
  109.     #[ORM\JoinColumn(nullabletrueonDelete'SET NULL')]
  110.     private ?AbstractCursusProgression $cursusProgression null;
  111.     #[ORM\Column(type'integer'nullabletrue)]
  112.     #[TrackFIeld(name'cursus.entity.physicalDuration.label'fieldKey'progress', callable: 'formatDuration'callableClassNellappFormatService::class)]
  113.     #[
  114.         Assert\Type(type'integer'),
  115.         Assert\GreaterThanOrEqual(value0)
  116.     ]
  117.     private ?int $physicalDuration null;
  118.     #[ORM\Column(type'integer'nullabletrue)]
  119.     #[TrackFIeld(name'cursus.entity.distanceSyncDuration.label'fieldKey'progress', callable: 'formatDuration'callableClassNellappFormatService::class)]
  120.     #[
  121.         Assert\Type(type'integer'),
  122.         Assert\GreaterThanOrEqual(value0)
  123.     ]
  124.     private ?int $distanceSyncDuration null;
  125.     #[ORM\Column(type'integer'nullabletrue)]
  126.     #[TrackFIeld(name'cursus.entity.distanceAsyncDuration.label'fieldKey'progress', callable: 'formatDuration'callableClassNellappFormatService::class)]
  127.     #[
  128.         Assert\Type(type'integer'),
  129.         Assert\GreaterThanOrEqual(value0)
  130.     ]
  131.     private ?int $distanceAsyncDuration null;
  132.     #[ORM\Column(type'integer'nullabletrue)]
  133.     #[TrackFIeld(name'cursus.entity.examDuration.label'fieldKey'progress', callable: 'formatDuration'callableClassNellappFormatService::class)]
  134.     #[
  135.         Assert\Type(type'integer'),
  136.         Assert\GreaterThanOrEqual(value0)
  137.     ]
  138.     private ?int $examDuration null;
  139.     #[ORM\Column(type'integer'nullabletrue)]
  140.     #[TrackFIeld(name'cursus.entity.internshipDuration.label'fieldKey'progress', callable: 'formatDuration'callableClassNellappFormatService::class)]
  141.     #[
  142.         Assert\Type(type'integer'),
  143.         Assert\GreaterThanOrEqual(value0)
  144.     ]
  145.     private ?int $internshipDuration null;
  146.     #[ORM\Column(type'integer'nullabletrue)]
  147.     #[TrackFIeld(name'cursus.entity.cursusModality.label'fieldKey'progress', callable: 'getStatusKey'callableClassCursusModalityEnum::class)]
  148.     #[Assert\NotBlank(groups: ['CursusProgress'])]
  149.     #[Serial\Groups(['Sync'])]
  150.     private ?int $cursusModality null;
  151.     #[ORM\Column(type'integer'nullabletrue)]
  152.     #[TrackFIeld(name'cursus.entity.cursusCourse.label'fieldKey'progress', callable: 'getStatusKey'callableClassCursusCourseEnum::class)]
  153.     #[Assert\NotBlank(groups: ['CursusProgress'])]
  154.     #[Serial\Groups(['Sync'])]
  155.     private ?int $cursusCourse null;
  156.     #[ORM\Column(type'integer'nullabletrue)]
  157.     #[TrackFIeld(name'cursus.entity.foundingStatus.label'fieldKey'founding', callable: 'getStatusKey'callableClassCursusFoundingStatusEnum::class)]
  158.     #[Assert\Choice(
  159.         callback: [CursusFoundingStatusEnum::class, 'getChoices'],
  160.         groups: ['CursusFounding']
  161.     )]
  162.     private ?int $foundingStatus null;
  163.     #[ORM\ManyToOne(targetEntityOrganization::class)]
  164.     #[ORM\JoinColumn(nullabletrueonDelete"SET NULL")]
  165.     private ?Organization $organization null;
  166.     #[ORM\OneToMany(mappedBy'cursus'targetEntityFounder::class, cascade: ['remove'], orphanRemovaltrue)]
  167.     private Collection $founders;
  168.     #[ORM\Column(type'integer'nullabletrue)]
  169.     #[
  170.         Assert\NotBlank(groups: ['CursusInternship']),
  171.         Assert\Type(type'integer'groups: ['CursusInternship'])
  172.     ]
  173.     #[TrackFIeld(name'cursus.entity.internshipStatus.label'fieldKey'internship', callable: 'getStatusKey'callableClassCursusInternshipStatus::class)]
  174.     private ?int $internshipStatus 0;
  175.     #[ORM\OneToMany(mappedBy'cursus'targetEntityInternship::class, cascade: ['remove''persist'], orphanRemovaltrue)]
  176.     private Collection $internships;
  177.     #[ORM\Column(type'integer'nullabletrue)]
  178.     #[Serial\Groups(['Sync'])]
  179.     #[TrackFIeld(name'cursus.entity.stoppedStatus.label'fieldKey'progress', callable: 'getStatusKey'callableClassCursusStoppedStatusEnum::class)]
  180.     private ?int $stoppedStatus null;
  181.     #[ORM\Column(type'integer'nullabletrue)]
  182.     #[Assert\NotBlank(groups: ['CursusStatus'])]
  183.     #[TrackFIeld(name'cursus.entity.stoppedDetails.label'fieldKey'progress', callable: 'getStatusKey'callableClassCursusStoppedStatusEnum::class)]
  184.     private ?int $stoppedDetails null;
  185.     #[ORM\Column(type'datetime'nullabletrue)]
  186.     #[Serial\Groups(['Sync'])]
  187.     #[
  188.         Assert\NotBlank(message'abstract_cursus.stoppedAt.NotBlank'groups: ['CursusStatus']),
  189.         Assert\GreaterThanOrEqual('-45 days'message'abstract_cursus.stoppedAt.GreaterThanOrEqual'groups: ['CursusStatus']),
  190.     ]
  191.     #[TrackFIeld(name'cursus.entity.stoppedAt.label'fieldKey'progress', callable: 'format'callableParams: ['d/m/Y'])]
  192.     private ?\DateTimeInterface $stoppedAt null;
  193.     #[ORM\Column(type'text'nullabletrue)]
  194.     #[
  195.         Assert\Length(max500groups: ['CursusStatus'])
  196.     ]
  197.     private ?string $stoppedInfos null;
  198.     #[ORM\ManyToOne(targetEntityPlace::class)]
  199.     #[ORM\JoinColumn(nullabletrueonDelete'SET NULL')]
  200.     #[TrackFIeld(name'cursus.entity.examPlace.label'fieldKey'exam')]
  201.     private ?Place $examPlace null;
  202.     #[ORM\Column(type'datetime'nullabletrue)]
  203.     #[TrackFIeld(
  204.         name'cursus.entity.examSession.label',
  205.         fieldKey'exam',
  206.         callable: 'format',
  207.         callableParams: ['m/Y'])
  208.     ]
  209.     #[Assert\NotBlank(groups: ['CursusExam'])]
  210.     private ?DateTimeInterface $examSession null;
  211.     #[ORM\Column(type'string'nullabletrue)]
  212.     #[TrackFIeld(name'cursus.entity.examCeres.label'fieldKey'exam')]
  213.     #[
  214.         Assert\Length(max255groups: ['CursusExam'])
  215.     ]
  216.     private ?string $examCeres null;
  217.     #[ORM\Column(type'integer'nullabletrue)]
  218.     #[TrackFIeld(name'cursus.entity.examStatus.label'fieldKey'exam', callable: 'getStatusKey'callableClassExamStatusEnum::class)]
  219.     #[Assert\Choice(
  220.         callback: [ExamStatusEnum::class, 'getChoices'],
  221.         groups: ['CursusExam']
  222.     )]
  223.     private ?int $examStatus null;
  224.     #[ORM\Column(type'string'nullabletrue)]
  225.     #[TrackFIeld(name'cursus.entity.examCCP.label'fieldKey'exam')]
  226.     #[
  227.         Assert\Length(max255groups: ['CursusExam'])
  228.     ]
  229.     private ?string $examCCP null;
  230.     #[ORM\OneToMany(mappedBy'cursus'targetEntityExam::class, cascade: ['remove'], orphanRemovaltrue)]
  231.     private Collection $exams;
  232.     #[ORM\ManyToOne(targetEntityPlace::class)]
  233.     #[ORM\JoinColumn(nullabletrueonDelete'SET NULL')]
  234.     #[TrackFIeld(name'cursus.entity.place.label'fieldKey'progress')]
  235.     #[IdGroups(['Sync'])]
  236.     private ?Place $place null;
  237.     #[ORM\OneToMany(mappedBy'cursus'targetEntityReportDetails::class, cascade: ['remove'], fetch'EXTRA_LAZY'orphanRemovaltrue)]
  238.     private Collection $reportDetailsList;
  239.     #[ORM\OneToOne(targetEntityActivityFeed::class, cascade: ['remove''persist'], orphanRemovaltrue)]
  240.     #[ORM\JoinColumn(nullablefalse)]
  241.     private ?ActivityFeed $activityFeed null;
  242.     public function __construct()
  243.     {
  244.         $this->founders = new ArrayCollection();
  245.         $this->internships = new ArrayCollection();
  246.         $this->exams = new ArrayCollection();
  247.         $this->reportDetailsList = new ArrayCollection();
  248.     }
  249.     public static function getSyncKey(): string
  250.     {
  251.         return EntityKeys::ABSTRACT_CURSUS;
  252.     }
  253.     public function getSyncDisplayLabel(): string
  254.     {
  255.         return $this->getLabel() ?? 'unknown';
  256.     }
  257.     abstract public function getLabelType(): string;
  258.     public static function getPermissionResourceClass(): ?string
  259.     {
  260.         return ChannelUserCursusPermission::class;
  261.     }
  262.     public function getUserOwners(): array
  263.     {
  264.         $learner $this->getChannelUserData()?->getUser();
  265.         return $learner ? [$learner] : [];
  266.     }
  267.     #[Serial\Groups(['GlobalJSVariable'])]
  268.     public function getLearnerName(): ?string
  269.     {
  270.         return $this->getChannelUserData()?->getUser();
  271.     }
  272.     public function __toString(): string
  273.     {
  274.         return 'cursus ' $this->getLabel() . ' pour ' $this->getChannelUserData()?->getUser();
  275.     }
  276.     public function isTrainingType(): bool
  277.     {
  278.         return $this instanceof TrainingCursus;
  279.     }
  280.     public function isSessionType(): bool
  281.     {
  282.         return $this instanceof SessionCursus;
  283.     }
  284.     public function getChannel(): ?ChannelInterface
  285.     {
  286.         return $this->getChannelUserData()?->getChannel();
  287.     }
  288.     public function getOwnerChannel(): ?ChannelInterface
  289.     {
  290.         return $this->getChannel();
  291.     }
  292.     public function hasOneOralExam(): bool
  293.     {
  294.         if (!$this->getExams()->isEmpty()) {
  295.             /** @var Exam $exam */
  296.             foreach ($this->getExams() as $exam) {
  297.                 if ($exam->getType() === $exam::ORAL_TYPE) {
  298.                     return true;
  299.                 }
  300.             }
  301.         }
  302.         return false;
  303.     }
  304.     public function hasUser(?UserInterface $user, array $tags = []): bool
  305.     {
  306.         if (!in_array('internship_tutor'$tags)) {
  307.             return false;
  308.         }
  309.         if (!$user instanceof User) {
  310.             return false;
  311.         }
  312.         return $this->getInternships()->exists(function ($kInternship $internship) use ($user): bool {
  313.             return $internship->getTutor()?->getUser() === $user && $internship->isActiveWithDelays();
  314.         });
  315.     }
  316.     public function getLabel(): ?string
  317.     {
  318.         return $this->training?->getName();
  319.     }
  320.     public function getTotalDuration(): ?int
  321.     {
  322.         return $this->getPhysicalDurationDisplayed()
  323.             + $this->getDistanceAsyncDurationDisplayed()
  324.             + $this->getDistanceSyncDurationDisplayed()
  325.             + $this->getInternshipDurationDisplayed()
  326.             + $this->getExamDurationDisplayed();
  327.     }
  328.     public function getPhysicalDuration(): ?int
  329.     {
  330.         return $this->physicalDuration;
  331.     }
  332.     public function setPhysicalDuration(?int $physicalDuration): self
  333.     {
  334.         $this->physicalDuration $physicalDuration;
  335.         return $this;
  336.     }
  337.     public function getDistanceSyncDuration(): ?int
  338.     {
  339.         return $this->distanceSyncDuration;
  340.     }
  341.     public function setDistanceSyncDuration(?int $distanceSyncDuration): self
  342.     {
  343.         $this->distanceSyncDuration $distanceSyncDuration;
  344.         return $this;
  345.     }
  346.     public function getDistanceAsyncDuration(): ?int
  347.     {
  348.         return $this->distanceAsyncDuration;
  349.     }
  350.     public function setDistanceAsyncDuration(?int $distanceAsyncDuration): self
  351.     {
  352.         $this->distanceAsyncDuration $distanceAsyncDuration;
  353.         return $this;
  354.     }
  355.     public function getExamDuration(): ?int
  356.     {
  357.         return $this->examDuration;
  358.     }
  359.     public function setExamDuration(?int $examDuration): AbstractCursus
  360.     {
  361.         $this->examDuration $examDuration;
  362.         return $this;
  363.     }
  364.     public function getInternshipDuration(): ?int
  365.     {
  366.         return $this->internshipDuration;
  367.     }
  368.     public function setInternshipDuration(?int $internshipDuration): AbstractCursus
  369.     {
  370.         $this->internshipDuration $internshipDuration;
  371.         return $this;
  372.     }
  373.     public function getFoundingStatus(): ?int
  374.     {
  375.         return $this->foundingStatus;
  376.     }
  377.     public function setFoundingStatus(?int $foundingStatus): AbstractCursus
  378.     {
  379.         $this->foundingStatus $foundingStatus;
  380.         return $this;
  381.     }
  382.     public function getFounders(): Collection
  383.     {
  384.         return $this->founders;
  385.     }
  386.     public function addFounder(Founder $founder): static
  387.     {
  388.         if (!$this->founders->contains($founder)) {
  389.             $this->founders->add($founder);
  390.         }
  391.         return $this;
  392.     }
  393.     public function setFounders(Collection $founders): AbstractCursus
  394.     {
  395.         $this->founders $founders;
  396.         return $this;
  397.     }
  398.     /**
  399.      * @return Collection<Internship>
  400.      */
  401.     public function getInternships(): Collection
  402.     {
  403.         return $this->internships;
  404.     }
  405.     public function addInternship(Internship $internship): static
  406.     {
  407.         if (!$this->internships->contains($internship)) {
  408.             $this->internships->add($internship);
  409.         }
  410.         return $this;
  411.     }
  412.     public function setInternships(Collection $internships): AbstractCursus
  413.     {
  414.         $this->internships $internships;
  415.         return $this;
  416.     }
  417.     public function getInternshipStatus(): ?int
  418.     {
  419.         return $this->internshipStatus;
  420.     }
  421.     public function setInternshipStatus(?int $internshipStatus): AbstractCursus
  422.     {
  423.         $this->internshipStatus $internshipStatus;
  424.         return $this;
  425.     }
  426.     public function getMonthDuration(): ?int
  427.     {
  428.         return $this->monthDuration;
  429.     }
  430.     public function setMonthDuration(?int $monthDuration): AbstractCursus
  431.     {
  432.         $this->monthDuration $monthDuration;
  433.         return $this;
  434.     }
  435.     public function getCursusProgression(): ?AbstractCursusProgression
  436.     {
  437.         return $this->cursusProgression;
  438.     }
  439.     public function setCursusProgression(?AbstractCursusProgression $cursusProgression): AbstractCursus
  440.     {
  441.         $this->cursusProgression $cursusProgression;
  442.         return $this;
  443.     }
  444.     public function getExamPlace(): ?Place
  445.     {
  446.         return $this->examPlace;
  447.     }
  448.     public function setExamPlace(?Place $examPlace): AbstractCursus
  449.     {
  450.         $this->examPlace $examPlace;
  451.         return $this;
  452.     }
  453.     public function getExamSession(): ?DateTimeInterface
  454.     {
  455.         return $this->examSession;
  456.     }
  457.     public function setExamSession(?DateTimeInterface $examSession): AbstractCursus
  458.     {
  459.         $this->examSession $examSession;
  460.         return $this;
  461.     }
  462.     public function getExamCeres(): ?string
  463.     {
  464.         return $this->examCeres;
  465.     }
  466.     public function setExamCeres(?string $examCeres): AbstractCursus
  467.     {
  468.         $this->examCeres $examCeres;
  469.         return $this;
  470.     }
  471.     public function getExamStatus(): ?int
  472.     {
  473.         return $this->examStatus;
  474.     }
  475.     public function setExamStatus(?int $examStatus): AbstractCursus
  476.     {
  477.         $this->examStatus $examStatus;
  478.         return $this;
  479.     }
  480.     public function getExamCCP(): ?string
  481.     {
  482.         return $this->examCCP;
  483.     }
  484.     public function setExamCCP(?string $examCCP): AbstractCursus
  485.     {
  486.         $this->examCCP $examCCP;
  487.         return $this;
  488.     }
  489.     public function getExams(): Collection
  490.     {
  491.         return $this->exams;
  492.     }
  493.     public function addExam(Exam $exam): AbstractCursus
  494.     {
  495.         if (!$this->getExams()->contains($exam)) {
  496.             $this->getExams()->add($exam);
  497.         }
  498.         return $this;
  499.     }
  500.     public function setExams(Collection $exams): AbstractCursus
  501.     {
  502.         $this->exams $exams;
  503.         return $this;
  504.     }
  505.     public function getStoppedInfos(): ?string
  506.     {
  507.         return $this->stoppedInfos;
  508.     }
  509.     public function setStoppedInfos(?string $stoppedInfos): AbstractCursus
  510.     {
  511.         $this->stoppedInfos $stoppedInfos;
  512.         return $this;
  513.     }
  514.     public function getStoppedDetails(): ?int
  515.     {
  516.         return $this->stoppedDetails;
  517.     }
  518.     public function setStoppedDetails(?int $stoppedDetails): AbstractCursus
  519.     {
  520.         $this->stoppedDetails $stoppedDetails;
  521.         return $this;
  522.     }
  523.     public function getPlace(): ?Place
  524.     {
  525.         return $this->place;
  526.     }
  527.     public function setPlace(?Place $place): static
  528.     {
  529.         $this->place $place;
  530.         return $this;
  531.     }
  532.     public function getPhysicalDurationDisplayed(): ?int
  533.     {
  534.         if ($this->getPhysicalDuration() !== null && $this->getPhysicalDuration() !== 0) {
  535.             return $this->getPhysicalDuration();
  536.         }
  537.         if ($this instanceof SessionCursus) {
  538.             return $this->getSession()?->getDurationInCenter();
  539.         }
  540.         return null;
  541.     }
  542.     public function getDistanceAsyncDurationDisplayed(): ?int
  543.     {
  544.         if ($this->getDistanceAsyncDuration() !== null && $this->getDistanceAsyncDuration() !== 0) {
  545.             return $this->getDistanceAsyncDuration();
  546.         }
  547.         if ($this instanceof SessionCursus) {
  548.             return $this->getSession()?->getDurationInELearning();
  549.         }
  550.         return null;
  551.     }
  552.     public function getDistanceSyncDurationDisplayed(): ?int
  553.     {
  554.         if ($this->getDistanceSyncDuration() !== null && $this->getDistanceSyncDuration() !== 0) {
  555.             return $this->getDistanceSyncDuration();
  556.         }
  557.         if ($this instanceof SessionCursus) {
  558.             return $this->getSession()?->getDurationInVisio();
  559.         }
  560.         return null;
  561.     }
  562.     public function getInternshipDurationDisplayed(): ?int
  563.     {
  564.         if ($this->getInternshipDuration() !== null && $this->getInternshipDuration() !== 0) {
  565.             return $this->getInternshipDuration();
  566.         }
  567.         if ($this instanceof SessionCursus) {
  568.             return $this->getSession()?->getDurationInCompany();
  569.         }
  570.         if (!$this->getInternships()->isEmpty()) {
  571.             $internshipDuration 0;
  572.             /** @var Internship $internship */
  573.             foreach ($this->getInternships() as $internship) {
  574.                 if ($internship->getDuration() !== null) {
  575.                     $internshipDuration += $internship->getDuration();
  576.                 }
  577.             }
  578.             return $internshipDuration;
  579.         }
  580.         return null;
  581.     }
  582.     public function getInternshipDurationForProgress(): ?int
  583.     {
  584.         if ($this->getInternshipDuration() !== null  && $this->getInternshipDuration() !== 0) {
  585.             return $this->getInternshipDuration();
  586.         }
  587.         if (!$this->getInternships()->isEmpty()) {
  588.             $internshipDuration 0;
  589.             /** @var Internship $internship */
  590.             foreach ($this->getInternships() as $internship) {
  591.                 if ($internship->getDuration() !== null) {
  592.                     $internshipDuration += $internship->getDuration();
  593.                 }
  594.             }
  595.             return $internshipDuration;
  596.         }
  597.         return null;
  598.     }
  599.     public function getExamDurationDisplayed(): ?int
  600.     {
  601.         if ($this->getExamDuration() !== null && $this->getExamDuration() !== 0) {
  602.             return $this->getExamDuration();
  603.         }
  604.         if ($this instanceof SessionCursus) {
  605.             return $this->getSession()?->getDurationInExam();
  606.         }
  607.         return null;
  608.     }
  609.     public function getOrganization(): ?Organization
  610.     {
  611.         return $this->organization;
  612.     }
  613.     public function setOrganization(?Organization $organization): AbstractCursus
  614.     {
  615.         $this->organization $organization;
  616.         return $this;
  617.     }
  618.     public function getReportDetailsList(): Collection
  619.     {
  620.         return $this->reportDetailsList ?? $this->reportDetailsList = new ArrayCollection();
  621.     }
  622.     public function setReportDetailsList(Collection $reportDetailsList): AbstractCursus
  623.     {
  624.         $this->reportDetailsList $reportDetailsList;
  625.         return $this;
  626.     }
  627.     public function getActivityFeed(): ?ActivityFeed
  628.     {
  629.         return $this->activityFeed;
  630.     }
  631.     public function setActivityFeed(?ActivityFeed $activityFeed): AbstractCursus
  632.     {
  633.         $this->activityFeed $activityFeed;
  634.         return $this;
  635.     }
  636. }