src/Entity/ElCourse.php line 159

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Annotation\EsUploadable;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use App\Entity\Model\BulletPoint;
  6. use App\Annotation\EsElasticIndex;
  7. use App\Filter\SearchWithTagFilter;
  8. use App\Filter\ElCourseArchiveFilter;
  9. use App\Repository\ElCourseRepository;
  10. use ApiPlatform\Core\Annotation\ApiFilter;
  11. use App\Entity\Traits\TimestampableEntity;
  12. use Doctrine\Common\Collections\Collection;
  13. use ApiPlatform\Core\Annotation\ApiResource;
  14. use App\Entity\Interfaces\UploadMappedInterface;
  15. use Doctrine\Common\Collections\ArrayCollection;
  16. use App\Entity\Interfaces\ElasticMappedInterface;
  17. use App\Entity\Interfaces\ElCopyRestrictInterface;
  18. use App\Entity\Interfaces\ContainerMappedInterface;
  19. use Symfony\Component\Serializer\Annotation\Groups;
  20. use App\Entity\Interfaces\OperationLogMappedInterface;
  21. use Symfony\Component\Validator\Constraints as Assert;
  22. use App\Entity\Interfaces\NewsfeedAssetCreatorInterface;
  23. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\DateFilter;
  24. use Symfony\Component\Serializer\Annotation\SerializedName;
  25. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter;
  26. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\RangeFilter;
  27. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\ExistsFilter;
  28. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
  29. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\BooleanFilter;
  30. use Locastic\ApiPlatformTranslationBundle\Model\AbstractTranslatable;
  31. use Locastic\ApiPlatformTranslationBundle\Model\TranslationInterface;
  32. /**
  33.  * @ApiResource(
  34.  *      attributes={"security"="is_granted('ROLE_OPERATOR')", "filters"={"translation.groups"}},
  35.  *      normalizationContext={"groups"={"ElCourse:Read"}, "skip_null_values"=false},
  36.  *      denormalizationContext={"groups"={"ElCourse:Write"}},
  37.  *      collectionOperations={
  38.  *          "get"={"pagination_use_output_walkers"=true},
  39.  *          "get_all"={
  40.  *              "path"="/el_courses/get-all",
  41.  *              "method"="GET",
  42.  *              "normalization_context"={"groups"={"ElCourse:Read"}, "skip_null_values"=false},
  43.  *              "security"="is_granted('IS_AUTHENTICATED_FULLY')",
  44.  *              "pagination_use_output_walkers"=true
  45.  *          },
  46.  *          "get_for_instructor"={
  47.  *              "path"="/el_courses/get-for-instructor",
  48.  *              "method"="GET",
  49.  *              "normalization_context"={"groups"={"ElCourse:Read"}, "skip_null_values"=false},
  50.  *              "security"="is_granted('ROLE_INSTRUCTOR')",
  51.  *              "pagination_use_output_walkers"=true
  52.  *          },
  53.  *          "get_for_select"={
  54.  *              "path"="/el_courses/get-for-select",
  55.  *              "method"="GET",
  56.  *              "normalization_context"={"groups"={"ElCourse:Select"}, "skip_null_values"=false},
  57.  *              "pagination_enabled"=false
  58.  *          },
  59.  *          "get_for_copy"={
  60.  *              "path"="/el_courses/get-for-copy",
  61.  *              "method"="GET",
  62.  *              "normalization_context"={"groups"={"ElCourse:Select"}, "skip_null_values"=false},
  63.  *              "pagination_enabled"=false
  64.  *          },
  65.  *          "get_my"={
  66.  *              "path"="/el_courses/get-my",
  67.  *              "method"="GET",
  68.  *              "normalization_context"={"groups"={"ElCourse:Read"}, "skip_null_values"=false},
  69.  *              "security"="is_granted('IS_AUTHENTICATED_FULLY')",
  70.  *              "pagination_use_output_walkers"=true
  71.  *          },
  72.  *          "get_user_course"={
  73.  *              "path"="/el_courses/get-user-course",
  74.  *              "method"="GET",
  75.  *              "normalization_context"={"groups"={"ElCourse:Read"}, "skip_null_values"=false},
  76.  *              "security"="is_granted('IS_AUTHENTICATED_FULLY')",
  77.  *              "pagination_use_output_walkers"=true
  78.  *          },
  79.  *          "get_for_public_page"={
  80.  *              "route_name"="api_pub_el_courses_get_for_public_page_collection",
  81.  *              "method"="GET",
  82.  *              "security"="is_granted('PUBLIC_ACCESS')",
  83.  *              "normalization_context"={"groups"={"ElCourse:PRead"}, "skip_null_values"=false},
  84.  *              "pagination_enabled"=true
  85.  *          },
  86.  *          "get_user_saved"={
  87.  *              "path"="/el_courses/get-user-saved",
  88.  *              "method"="GET",
  89.  *              "normalization_context"={"groups"={"ElCourse:Read"}, "skip_null_values"=false},
  90.  *              "security"="is_granted('IS_AUTHENTICATED_FULLY')"
  91.  *          },
  92.  *          "post"={
  93.  *              "security"="is_granted('ROLE_OPERATOR') or is_granted('ROLE_INSTRUCTOR')"
  94.  *          },
  95.  *          "post_certificate_prepare"={
  96.  *              "route_name"="api_el_courses_certificate_prepare",
  97.  *              "method"="POST",
  98.  *              "denormalization_context"={"groups"={"ElCourse:Clone"}},
  99.  *          },
  100.  *          "post_certificate_send"={
  101.  *              "route_name"="api_el_courses_certificate_send",
  102.  *              "method"="POST",
  103.  *              "denormalization_context"={"groups"={"ElCourse:Clone"}},
  104.  *          },
  105.  *          "post_reset_submissions"={
  106.  *              "route_name"="api_el_courses_reset_submissions",
  107.  *              "method"="POST",
  108.  *              "denormalization_context"={"groups"={"ElCourse:Clone"}},
  109.  *              "security"="is_granted('ROLE_ADMIN')"
  110.  *          },
  111.  *          "post_copy"={
  112.  *              "route_name"="api_el_courses_copy",
  113.  *              "method"="POST",
  114.  *              "denormalization_context"={"groups"={"ElCourse:Copy"}}
  115.  *          }
  116.  *      },
  117.  *      itemOperations={
  118.  *          "get"={
  119.  *              "security"="is_granted('IS_AUTHENTICATED_FULLY', object)",
  120.  *              "normalization_context"={"groups"={"ElCourse:Read", "ElCourse:Detail"}, "skip_null_values"=false}
  121.  *          },
  122.  *          "get_detail"={
  123.  *              "path"="/el_courses/{id}/get-detail",
  124.  *              "method"="GET",
  125.  *              "normalization_context"={"groups"={"ElCourse:Read", "ElCourse:Detail"}, "skip_null_values"=false},
  126.  *              "security"="is_granted('IS_AUTHENTICATED_FULLY', object)"
  127.  *          },
  128.  *          "get_for_public_item_page"={
  129.  *              "route_name"="api_pub_el_courses_get_for_public_page_item",
  130.  *              "method"="GET",
  131.  *              "security"="is_granted('PUBLIC_ACCESS')",
  132.  *              "normalization_context"={"groups"={"ElCourse:PRead", "ElCourse:PIRead"}, "skip_null_values"=false}
  133.  *          },
  134.  *          "put"={"security"="is_granted('IS_CO_OPR', object) or is_granted('IS_CO_INS_SPE_COURSE', object)"},
  135.  *          "patch"={"security"="is_granted('IS_CO_OPR', object) or is_granted('IS_CO_INS_SPE_COURSE', object)"},
  136.  *          "patch_start_course"={
  137.  *              "route_name"="api_el_courses_start_course",
  138.  *              "method"="PATCH",
  139.  *              "security"="is_granted('IS_AUTHENTICATED_FULLY', object)",
  140.  *              "denormalization_context"={"groups"={"ElCourse:Start-Course"}}
  141.  *          },
  142.  *          "delete"={"security"="is_granted('IS_CO_OPR', object) or is_granted('IS_CO_INS_SPE_COURSE', object)"}
  143.  *     }
  144.  * )
  145.  * @ApiFilter(SearchFilter::class, properties={"id": "exact", "container.id": "exact", "elLessions.id": "exact", "elLessionTopics.id": "exact", "elTasks.id": "exact", "elCourseCategory.id": "exact", "elCourseTags.id": "exact", "speakers.id": "exact", "experts.id": "exact", "translations.name": "partial", "users.id": "exact", "elCourseJoins.user.id": "exact", "certificateTemplate.id": "exact", "instructor.id": "exact", "elCourseCredits.creditCategory.id": "exact", "companies.id": "exact"})
  146.  * @ApiFilter(SearchWithTagFilter::class, properties={"search_with_tag": "partial"})
  147.  * @ApiFilter(DateFilter::class, properties={"start", "end", "availableStart", "availableEnd"})
  148.  * @ApiFilter(BooleanFilter::class, properties={"isCertificate"})
  149.  * @ApiFilter(ElCourseArchiveFilter::class, properties={"is_archive"})
  150.  * @ApiFilter(OrderFilter::class, properties={"translations.name": "ASC", "id", "start", "end", "availableStart", "availableEnd"})
  151.  * @ApiFilter(RangeFilter::class, properties={"price", "averageRating", "totalRating", "duration"})
  152.  * @ApiFilter(ExistsFilter::class, properties={"price"})
  153.  * @ORM\Entity(repositoryClass=ElCourseRepository::class)
  154.  * @EsElasticIndex("ElCourse:EL")
  155.  */
  156. class ElCourse extends AbstractTranslatable implements ContainerMappedInterfaceUploadMappedInterfaceNewsfeedAssetCreatorInterfaceOperationLogMappedInterfaceElasticMappedInterfaceElCopyRestrictInterface
  157. {
  158.     /**
  159.      * Hook timestampable behavior
  160.      * updates createdAt, updatedAt fields
  161.      */
  162.     use TimestampableEntity;
  163.     /**
  164.      * @ORM\OneToMany(targetEntity="ElCourseTranslation", mappedBy="translatable", fetch="EXTRA_LAZY", indexBy="locale", cascade={"PERSIST"}, orphanRemoval=true)
  165.      *
  166.      * @Groups({"ElCourse:EL", "ElCourse:Write", "ElCourseTranslationGroup", "ElCourse:PRead"})
  167.      * @Assert\Valid()
  168.      */
  169.     protected $translations;
  170.     /**
  171.      * @Groups({"ElCourse:Select", "ElCourse:Read", "ElExam:Read", "ElTask:Read", "ElTask:Read-My", "ElExamAttempt:Read", "ElLessionTopic:Read", "ElCourseJoin:Read", "ElCourse:PRead", "ElTask:VideoGallery", "Certificate:Read", "CartItem:Read"})
  172.      */
  173.     private $name;
  174.     /**
  175.      * @Groups({"ElCourse:Read", "ElCourse:PRead"})
  176.      */
  177.     private $description;
  178.     /**
  179.      * @Groups({"ElCourse:Clone"})
  180.      */
  181.     private int $cloneId;
  182.     /**
  183.      * @Groups({"ElCourse:Copy"})
  184.      */
  185.     private string $copyType;
  186.     public const ELCOURSE_COPYTYPE_COURSE "COURSE";
  187.     public const ELCOURSE_COPYTYPE_LESSION "LESSION";
  188.     public const ELCOURSE_COPYTYPE_TOPIC "TOPIC";
  189.     public const ELCOURSE_COPYTYPE_TASK "TASK";
  190.     public const ELCOURSE_COPYTYPE_EXAM "EXAM";
  191.     /**
  192.      * @Groups({"ElCourse:Copy"})
  193.      */
  194.     private int $sourceId;
  195.     /**
  196.      * @Groups({"ElCourse:Copy"})
  197.      */
  198.     private int $targetId;
  199.     /**
  200.      * @Groups({"ElCourse:Copy"})
  201.      */
  202.     private ?string $copyLevel null;
  203.     /**
  204.      * @ORM\Id
  205.      * @ORM\GeneratedValue
  206.      * @ORM\Column(type="integer")
  207.      * @Groups({"ElCourse:EL", "ElCourse:Select", "ElCourse:Read", "ElExam:Read", "ElTask:Read", "ElExamAttempt:Read", "ElLessionTopic:Read", "ElCourseJoin:Read", "ElCourse:PRead", "ElTask:VideoGallery", "Certificate:Read", "CartItem:Read"})
  208.      */
  209.     private $id;
  210.     /**
  211.      * @ORM\Column(type="string", length=255, nullable=true)
  212.      * @Groups({"ElCourse:EL", "ElCourse:Select", "ElCourse:Read", "ElCourse:Write", "ElCourse:PRead", "CartItem:Read"})
  213.      *
  214.      * @EsUploadable()
  215.      */
  216.     protected $imageName;
  217.     /**
  218.      * @ORM\Column(type="boolean", nullable=true)
  219.      * @Groups({"ElCourse:Read", "ElCourse:Write"})
  220.      */
  221.     private $isRegistrationRequired;
  222.     /**
  223.      * @ORM\Column(type="boolean", nullable=true)
  224.      * @Groups({"ElCourse:Read", "ElCourse:Write", "ElTask:Read", "ElExam:Read"})
  225.      */
  226.     private $isStepByStepCompletion;
  227.     /**
  228.      * @ORM\ManyToOne(targetEntity=Container::class)
  229.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  230.      * @Groups({"ElCourse:Write", "ElCourse:PRead", "ElCourse:Copy", "CartItem:Read"})
  231.      */
  232.     private $container;
  233.     /**
  234.      * @ORM\ManyToOne(targetEntity=CommonCategory::class)
  235.      * @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
  236.      * @Groups({"ElCourse:Read", "ElCourse:Write", "ElCourse:PRead"})
  237.      */
  238.     private $elCourseCategory;
  239.     /**
  240.      * @ORM\ManyToMany(targetEntity=ElCourseTag::class, inversedBy="elCourses", cascade={"persist"})
  241.      * @Groups({"ElCourse:Read", "ElCourse:Write"})
  242.      */
  243.     private $elCourseTags;
  244.     /**
  245.      * @ORM\ManyToMany(targetEntity=UserGroup::class)
  246.      * @Groups({"ElCourse:Read", "ElCourse:Write"})
  247.      */
  248.     private $userGroups;
  249.     /**
  250.      * @ORM\OneToMany(targetEntity=ElLession::class, mappedBy="elCourse", orphanRemoval=true)
  251.      * @Groups({"ElCourse:Detail", "ElCourse:PRead"})
  252.      */
  253.     private $elLessions;
  254.     /**
  255.      * @ORM\Column(type="datetime", nullable=true)
  256.      * @Groups({"ElCourse:EL", "ElCourse:Read", "ElCourse:PRead", "ElTask:VideoGallery"})
  257.      */
  258.     private $start;
  259.     /**
  260.      * @ORM\Column(type="datetime", nullable=true)
  261.      * @Groups({"ElCourse:EL", "ElCourse:Read", "ElCourse:PRead", "ElTask:VideoGallery"})
  262.      */
  263.     private $end;
  264.     /**
  265.      * @ORM\ManyToMany(targetEntity=User::class)
  266.      * @ORM\JoinTable(name="rel_elcourse_speaker")
  267.      * @Groups({"ElCourse:EL", "ElCourse:Read", "ElCourse:PRead"})
  268.      * @ORM\OrderBy({"lastName" = "ASC"})
  269.      */
  270.     private $speakers;
  271.     /**
  272.      * @ORM\ManyToMany(targetEntity=User::class)
  273.      * @ORM\JoinTable(name="rel_elcourse_expert")
  274.      * @Groups({"ElCourse:EL", "ElCourse:Read", "ElCourse:PRead"})
  275.      * @ORM\OrderBy({"lastName" = "ASC"})
  276.      */
  277.     private $experts;
  278.     /**
  279.      * @ORM\OneToMany(targetEntity=ElLessionTopic::class, mappedBy="elCourse", orphanRemoval=true)
  280.      */
  281.     private $elLessionTopics;
  282.     /**
  283.      * @ORM\OneToMany(targetEntity=ElTask::class, mappedBy="elCourse", orphanRemoval=true)
  284.      */
  285.     private $elTasks;
  286.     /**
  287.      * @ORM\Column(type="integer", nullable=true)
  288.      * @Groups({"ElCourse:EL", "ElCourse:Read", "ElCourse:PRead"})
  289.      */
  290.     private $duration;
  291.     /**
  292.      * @ORM\OneToMany(targetEntity=ElExam::class, mappedBy="elCourse")
  293.      */
  294.     private $elExams;
  295.     /**
  296.      * @ORM\OneToMany(targetEntity=ElExam::class, mappedBy="elCourseAlways", orphanRemoval=true)
  297.      */
  298.     private $elAllExams;
  299.     /**
  300.      * @ORM\ManyToMany(targetEntity=User::class, inversedBy="elCourses")
  301.      */
  302.     private $users;
  303.     /**
  304.      * @ORM\OneToMany(targetEntity=ElCourseJoin::class, mappedBy="elCourse", orphanRemoval=true)
  305.      */
  306.     private $elCourseJoins;
  307.     /**
  308.      * @ORM\Column(type="boolean", nullable=true)
  309.      * @Groups({"ElCourse:Read", "ElCourse:Write"})
  310.      */
  311.     private $isActive;
  312.     /**
  313.      * @ORM\Column(type="datetime", nullable=true)
  314.      * @Groups({"ElCourse:EL", "ElCourse:Read", "ElCourse:Write", "ElTask:Read", "ElExam:Read", "ElCourse:PRead"})
  315.      */
  316.     private $availableStart;
  317.     /**
  318.      * @ORM\Column(type="datetime", nullable=true)
  319.      * @Groups({"ElCourse:EL", "ElCourse:Read", "ElCourse:Write", "ElTask:Read", "ElExam:Read", "ElCourse:PRead"})
  320.      */
  321.     private $availableEnd;
  322.     /**
  323.      * @ORM\Column(type="json", nullable=true)
  324.      * @Groups({"ElCourse:Detail", "ElTask:Read", "ElExam:Read", "ElCourse:PIRead"})
  325.      */
  326.     private $courseIndex = [];
  327.     /**
  328.      * @ORM\Column(type="boolean", nullable=true)
  329.      * @Groups({"ElCourse:Read", "ElCourse:Write"})
  330.      */
  331.     private $isShowPublic;
  332.     /**
  333.      * @ORM\Column(type="array", nullable=true)
  334.      * @Groups({"ElCourse:EL", "ElCourse:Read", "ElCourse:Write", "ElCourse:PRead"})
  335.      */
  336.     private $bulletPoints = [];
  337.     /**
  338.      * @ORM\Column(type="boolean", nullable=true)
  339.      * @Groups({"ElCourse:Read", "ElCourse:Write"})
  340.      */
  341.     private $isCertificate;
  342.     /**
  343.      * @ORM\ManyToOne(targetEntity=CertificateTemplate::class)
  344.      * @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
  345.      * @Groups({"ElCourse:Read", "ElCourse:Write"})
  346.      */
  347.     private $certificateTemplate;
  348.     /**
  349.      * @ORM\Column(type="boolean", nullable=true)
  350.      * @Groups({"ElCourse:EL", "ElCourse:Read", "ElCourse:Write"})
  351.      */
  352.     private $isShowDate;
  353.     /**
  354.      * @ORM\Column(type="integer", nullable=true)
  355.      * @Groups({"ElCourse:Read", "ElCourse:Write"})
  356.      */
  357.     private $certificateProgress;
  358.     /**
  359.      * @ORM\OneToMany(targetEntity=ElCourseCredit::class, mappedBy="elCourse", orphanRemoval=true, cascade={"persist"})
  360.      * @Groups({"ElCourse:Read", "ElCourse:Write", "ElCourse:PRead"})
  361.      */
  362.     private $elCourseCredits;
  363.     /**
  364.      * @ORM\ManyToOne(targetEntity=User::class)
  365.      * @Groups({"ElCourse:Read", "ElCourse:Write", "ElCourse:PRead", "CartItem:Read"})
  366.      */
  367.     private $instructor;
  368.     /**
  369.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  370.      * @Groups({"ElCourse:Read", "ElCourse:Write", "ElCourse:PRead", "CartItem:Read"})
  371.      */
  372.     private $originalPrice;
  373.     /**
  374.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  375.      * @Groups({"ElCourse:Read", "ElCourse:Write", "ElCourse:PRead", "CartItem:Read"})
  376.      */
  377.     private $price;
  378.     /**
  379.      * @ORM\Column(type="integer", nullable=true)
  380.      * @Groups({"ElCourse:Read", "ElCourse:PRead", "CartItem:Read"})
  381.      */
  382.     private $totalRating;
  383.     /**
  384.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  385.      * @Groups({"ElCourse:Read", "ElCourse:PRead", "CartItem:Read"})
  386.      */
  387.     private $averageRating;
  388.     /**
  389.      * @ORM\OneToMany(targetEntity=ElCourseRating::class, mappedBy="elCourse", orphanRemoval=true)
  390.      */
  391.     private $elCourseRatings;
  392.     /**
  393.      * @ORM\OneToMany(targetEntity=ElCourseSaved::class, mappedBy="elCourse")
  394.      */
  395.     private $elCourseSaved;
  396.     /**
  397.      * @ORM\ManyToMany(targetEntity=Company::class)
  398.      * @Groups({"ElCourse:Read", "ElCourse:Write", "ElCourse:PRead"})
  399.      */
  400.     private $companies;
  401.     public function __construct()
  402.     {
  403.         parent::__construct();
  404.         $this->elCourseTags = new ArrayCollection();
  405.         $this->userGroups = new ArrayCollection();
  406.         $this->elLessions = new ArrayCollection();
  407.         $this->speakers = new ArrayCollection();
  408.         $this->experts = new ArrayCollection();
  409.         $this->elLessionTopics = new ArrayCollection();
  410.         $this->elTasks = new ArrayCollection();
  411.         $this->elExams = new ArrayCollection();
  412.         $this->elAllExams = new ArrayCollection();
  413.         $this->users = new ArrayCollection();
  414.         $this->elCourseJoins = new ArrayCollection();
  415.         $bulletPointModel = new BulletPoint();
  416.         $this->bulletPoints $bulletPointModel->getProperties();
  417.         $this->elCourseCredits = new ArrayCollection();
  418.         $this->elCourseRatings = new ArrayCollection();
  419.         $this->elCourseSaved = new ArrayCollection();
  420.         $this->companies = new ArrayCollection();
  421.     }
  422.     protected function createTranslation(): TranslationInterface
  423.     {
  424.         return new ElCourseTranslation();
  425.     }
  426.     public function addTranslation(TranslationInterface $translation): void
  427.     {
  428.         $this->setUpdatedAt(new \DateTime());
  429.         parent::addTranslation($translation);
  430.     }
  431.     public function getName(): ?string
  432.     {
  433.         return $this->getTranslation()->getName();
  434.     }
  435.     public function setName(string $name): self
  436.     {
  437.         $this->getTranslation()->setName($name);
  438.         return $this;
  439.     }
  440.     public function getDescription(): ?string
  441.     {
  442.         return $this->getTranslation()->getDescription();
  443.     }
  444.     public function setDescription(string $description): self
  445.     {
  446.         $this->getTranslation()->setDescription($description);
  447.         return $this;
  448.     }
  449.     public function getId(): ?int
  450.     {
  451.         return $this->id;
  452.     }
  453.     public function getImageName(): ?string
  454.     {
  455.         return $this->imageName;
  456.     }
  457.     public function setImageName(?string $imageName): self
  458.     {
  459.         $this->imageName $imageName;
  460.         return $this;
  461.     }
  462.     public function getIsRegistrationRequired(): ?bool
  463.     {
  464.         return $this->isRegistrationRequired;
  465.     }
  466.     public function setIsRegistrationRequired(?bool $isRegistrationRequired): self
  467.     {
  468.         $this->isRegistrationRequired $isRegistrationRequired;
  469.         return $this;
  470.     }
  471.     public function getIsStepByStepCompletion(): ?bool
  472.     {
  473.         return $this->isStepByStepCompletion;
  474.     }
  475.     public function setIsStepByStepCompletion(?bool $isStepByStepCompletion): self
  476.     {
  477.         $this->isStepByStepCompletion $isStepByStepCompletion;
  478.         return $this;
  479.     }
  480.     public function getContainer(): ?Container
  481.     {
  482.         return $this->container;
  483.     }
  484.     public function setContainer(?Container $container): self
  485.     {
  486.         $this->container $container;
  487.         return $this;
  488.     }
  489.     public function getElCourseCategory(): ?CommonCategory
  490.     {
  491.         return $this->elCourseCategory;
  492.     }
  493.     public function setElCourseCategory(?CommonCategory $elCourseCategory): self
  494.     {
  495.         $this->elCourseCategory $elCourseCategory;
  496.         return $this;
  497.     }
  498.     /**
  499.      * @return Collection|ElCourseTag[]
  500.      */
  501.     public function getElCourseTags(): Collection
  502.     {
  503.         return $this->elCourseTags;
  504.     }
  505.     /**
  506.      * @Groups({"ElCourse:EL"})
  507.      * @SerializedName("tags")
  508.      */
  509.     public function getTagsArray()
  510.     {
  511.         $tags = [];
  512.         foreach ($this->elCourseTags as $tag) {
  513.             $tags[] = $tag->getName();
  514.         }
  515.         return $tags;
  516.     }
  517.     public function addElCourseTag(ElCourseTag $elCourseTag): self
  518.     {
  519.         if (!$this->elCourseTags->contains($elCourseTag)) {
  520.             $this->elCourseTags[] = $elCourseTag;
  521.         }
  522.         return $this;
  523.     }
  524.     public function removeElCourseTag(ElCourseTag $elCourseTag): self
  525.     {
  526.         $this->elCourseTags->removeElement($elCourseTag);
  527.         return $this;
  528.     }
  529.     public function reAttachTags(): self
  530.     {
  531.         $tags $this->elCourseTags;
  532.         foreach ($tags as $tag) {
  533.             $nt = clone $tag;
  534.             $nt->setContainer($this->getContainer());
  535.             $this->removeElCourseTag($tag);
  536.             $this->addElCourseTag($nt);
  537.         }
  538.         return $this;
  539.     }
  540.     /**
  541.      * @return Collection|UserGroup[]
  542.      */
  543.     public function getUserGroups(): Collection
  544.     {
  545.         return $this->userGroups;
  546.     }
  547.     /**
  548.      * @Groups({"ElCourse:EL"})
  549.      * @SerializedName("groups")
  550.      */
  551.     public function getUserGroupsArray()
  552.     {
  553.         $groups = [];
  554.         foreach ($this->userGroups as $group) {
  555.             if (!$group->getIsGenerated()) {
  556.                 $groups[] = $group->getId();
  557.             }
  558.         }
  559.         return $groups;
  560.     }
  561.     public function addUserGroup(UserGroup $userGroup): self
  562.     {
  563.         if (!$this->userGroups->contains($userGroup)) {
  564.             $this->userGroups[] = $userGroup;
  565.         }
  566.         return $this;
  567.     }
  568.     public function removeUserGroup(UserGroup $userGroup): self
  569.     {
  570.         $this->userGroups->removeElement($userGroup);
  571.         return $this;
  572.     }
  573.     public function removeAllUserGroups(): self
  574.     {
  575.         foreach ($this->userGroups as $userGroup) {
  576.             $this->removeUserGroup($userGroup);
  577.         }
  578.         return $this;
  579.     }
  580.     /**
  581.      * @return Collection|ElLession[]
  582.      */
  583.     public function getElLessions(): Collection
  584.     {
  585.         return $this->elLessions;
  586.     }
  587.     public function addElLession(ElLession $elLession): self
  588.     {
  589.         if (!$this->elLessions->contains($elLession)) {
  590.             $this->elLessions[] = $elLession;
  591.             $elLession->setElCourse($this);
  592.         }
  593.         return $this;
  594.     }
  595.     public function removeElLession(ElLession $elLession): self
  596.     {
  597.         if ($this->elLessions->removeElement($elLession)) {
  598.             // set the owning side to null (unless already changed)
  599.             if ($elLession->getElCourse() === $this) {
  600.                 $elLession->setElCourse(null);
  601.             }
  602.         }
  603.         return $this;
  604.     }
  605.     /**
  606.      * @Groups({"ElCourse:Read"})
  607.      */
  608.     public function getTotalElLessions()
  609.     {
  610.         if (empty($this->elLessions)) {
  611.             return 0;
  612.         }
  613.         return count($this->elLessions);
  614.     }
  615.     /**
  616.      * @Groups({"ElCourse:PRead"})
  617.      */
  618.     public function getTotalElTasks()
  619.     {
  620.         if (empty($this->elTasks)) {
  621.             return 0;
  622.         }
  623.         return count($this->elTasks);
  624.     }
  625.     /**
  626.      * @Groups({"ElCourse:PRead"})
  627.      */
  628.     public function getTotalElExams()
  629.     {
  630.         if (empty($this->elAllExams)) {
  631.             return 0;
  632.         }
  633.         return count($this->elAllExams);
  634.     }
  635.     public function getStart(): ?\DateTimeInterface
  636.     {
  637.         return $this->start;
  638.     }
  639.     public function setStart(?\DateTimeInterface $start): self
  640.     {
  641.         $this->start $start;
  642.         return $this;
  643.     }
  644.     public function getEnd(): ?\DateTimeInterface
  645.     {
  646.         return $this->end;
  647.     }
  648.     public function setEnd(?\DateTimeInterface $end): self
  649.     {
  650.         $this->end $end;
  651.         return $this;
  652.     }
  653.     /**
  654.      * @return Collection|User[]
  655.      */
  656.     public function getSpeakers(): Collection
  657.     {
  658.         return $this->speakers;
  659.     }
  660.     public function addSpeaker(User $speaker): self
  661.     {
  662.         if (!$this->speakers->contains($speaker)) {
  663.             $this->speakers[] = $speaker;
  664.         }
  665.         return $this;
  666.     }
  667.     public function removeSpeaker(User $speaker): self
  668.     {
  669.         $this->speakers->removeElement($speaker);
  670.         return $this;
  671.     }
  672.     public function removeAllSpeakers(): self
  673.     {
  674.         $speakers $this->getSpeakers();
  675.         foreach ($speakers as $speaker) {
  676.             $this->removeSpeaker($speaker);
  677.         }
  678.         return $this;
  679.     }
  680.     /**
  681.      * @return Collection|User[]
  682.      */
  683.     public function getExperts(): Collection
  684.     {
  685.         return $this->experts;
  686.     }
  687.     public function addExpert(User $expert): self
  688.     {
  689.         if (!$this->experts->contains($expert)) {
  690.             $this->experts[] = $expert;
  691.         }
  692.         return $this;
  693.     }
  694.     public function removeExpert(User $expert): self
  695.     {
  696.         $this->experts->removeElement($expert);
  697.         return $this;
  698.     }
  699.     public function removeAllExperts(): self
  700.     {
  701.         $experts $this->getExperts();
  702.         foreach ($experts as $expert) {
  703.             $this->removeExpert($expert);
  704.         }
  705.         return $this;
  706.     }
  707.     /**
  708.      * @return Collection|ElLessionTopic[]
  709.      */
  710.     public function getElLessionTopics(): Collection
  711.     {
  712.         return $this->elLessionTopics;
  713.     }
  714.     public function addElLessionTopic(ElLessionTopic $elLessionTopic): self
  715.     {
  716.         if (!$this->elLessionTopics->contains($elLessionTopic)) {
  717.             $this->elLessionTopics[] = $elLessionTopic;
  718.             $elLessionTopic->setElCourse($this);
  719.         }
  720.         return $this;
  721.     }
  722.     public function removeElLessionTopic(ElLessionTopic $elLessionTopic): self
  723.     {
  724.         if ($this->elLessionTopics->removeElement($elLessionTopic)) {
  725.             // set the owning side to null (unless already changed)
  726.             if ($elLessionTopic->getElCourse() === $this) {
  727.                 $elLessionTopic->setElCourse(null);
  728.             }
  729.         }
  730.         return $this;
  731.     }
  732.     /**
  733.      * @return Collection|ElTask[]
  734.      */
  735.     public function getElTasks(): Collection
  736.     {
  737.         return $this->elTasks;
  738.     }
  739.     public function addElTask(ElTask $elTask): self
  740.     {
  741.         if (!$this->elTasks->contains($elTask)) {
  742.             $this->elTasks[] = $elTask;
  743.             $elTask->setElCourse($this);
  744.         }
  745.         return $this;
  746.     }
  747.     public function removeElTask(ElTask $elTask): self
  748.     {
  749.         if ($this->elTasks->removeElement($elTask)) {
  750.             // set the owning side to null (unless already changed)
  751.             if ($elTask->getElCourse() === $this) {
  752.                 $elTask->setElCourse(null);
  753.             }
  754.         }
  755.         return $this;
  756.     }
  757.     public function getDuration(): ?int
  758.     {
  759.         return $this->duration;
  760.     }
  761.     public function setDuration(?int $duration): self
  762.     {
  763.         $this->duration $duration;
  764.         return $this;
  765.     }
  766.     /**
  767.      * @return Collection|ElExam[]
  768.      */
  769.     public function getElExams(): Collection
  770.     {
  771.         return $this->elExams;
  772.     }
  773.     public function addElExam(ElExam $elExam): self
  774.     {
  775.         if (!$this->elExams->contains($elExam)) {
  776.             $this->elExams[] = $elExam;
  777.             $elExam->setElCourse($this);
  778.         }
  779.         return $this;
  780.     }
  781.     public function removeElExam(ElExam $elExam): self
  782.     {
  783.         if ($this->elExams->removeElement($elExam)) {
  784.             // set the owning side to null (unless already changed)
  785.             if ($elExam->getElCourse() === $this) {
  786.                 $elExam->setElCourse(null);
  787.             }
  788.         }
  789.         return $this;
  790.     }
  791.     /**
  792.      * @return Collection|ElExam[]
  793.      */
  794.     public function getElAllExams(): Collection
  795.     {
  796.         return $this->elAllExams;
  797.     }
  798.     public function addElAllExam(ElExam $elAllExam): self
  799.     {
  800.         if (!$this->elAllExams->contains($elAllExam)) {
  801.             $this->elAllExams[] = $elAllExam;
  802.             $elAllExam->setElCourseAlways($this);
  803.         }
  804.         return $this;
  805.     }
  806.     public function removeElAllExam(ElExam $elAllExam): self
  807.     {
  808.         if ($this->elAllExams->removeElement($elAllExam)) {
  809.             // set the owning side to null (unless already changed)
  810.             if ($elAllExam->getElCourseAlways() === $this) {
  811.                 $elAllExam->setElCourseAlways(null);
  812.             }
  813.         }
  814.         return $this;
  815.     }
  816.     /**
  817.      * @return Collection|User[]
  818.      */
  819.     public function getUsers(): Collection
  820.     {
  821.         return $this->users;
  822.     }
  823.     public function addUser(User $user): self
  824.     {
  825.         if (!$this->users->contains($user)) {
  826.             $this->users[] = $user;
  827.         }
  828.         return $this;
  829.     }
  830.     public function removeUser(User $user): self
  831.     {
  832.         $this->users->removeElement($user);
  833.         return $this;
  834.     }
  835.     /**
  836.      * @return Collection|ElCourseJoin[]
  837.      */
  838.     public function getElCourseJoins(): Collection
  839.     {
  840.         return $this->elCourseJoins;
  841.     }
  842.     public function addElCourseJoin(ElCourseJoin $elCourseJoin): self
  843.     {
  844.         if (!$this->elCourseJoins->contains($elCourseJoin)) {
  845.             $this->elCourseJoins[] = $elCourseJoin;
  846.             $elCourseJoin->setElCourse($this);
  847.         }
  848.         return $this;
  849.     }
  850.     public function removeElCourseJoin(ElCourseJoin $elCourseJoin): self
  851.     {
  852.         if ($this->elCourseJoins->removeElement($elCourseJoin)) {
  853.             // set the owning side to null (unless already changed)
  854.             if ($elCourseJoin->getElCourse() === $this) {
  855.                 $elCourseJoin->setElCourse(null);
  856.             }
  857.         }
  858.         return $this;
  859.     }
  860.     public function getIsActive(): ?bool
  861.     {
  862.         return $this->isActive;
  863.     }
  864.     public function setIsActive(?bool $isActive): self
  865.     {
  866.         $this->isActive $isActive;
  867.         return $this;
  868.     }
  869.     public function getAvailableStart(): ?\DateTimeInterface
  870.     {
  871.         return $this->availableStart;
  872.     }
  873.     public function setAvailableStart(?\DateTimeInterface $availableStart): self
  874.     {
  875.         $this->availableStart $availableStart;
  876.         return $this;
  877.     }
  878.     public function getAvailableEnd(): ?\DateTimeInterface
  879.     {
  880.         return $this->availableEnd;
  881.     }
  882.     public function setAvailableEnd(?\DateTimeInterface $availableEnd): self
  883.     {
  884.         $this->availableEnd $availableEnd;
  885.         return $this;
  886.     }
  887.     public function getCourseIndex(): ?array
  888.     {
  889.         return $this->courseIndex;
  890.     }
  891.     public function setCourseIndex(?array $courseIndex): self
  892.     {
  893.         $this->courseIndex $courseIndex;
  894.         return $this;
  895.     }
  896.     /**
  897.      * @Groups({"ElCourse:Read"})
  898.      */
  899.     public function getCurrentTime()
  900.     {
  901.         return new \DateTime();
  902.     }
  903.     /**
  904.      * @Groups({"ElCourse:Read"})
  905.      */
  906.     public function getIsArchive()
  907.     {
  908.         if ($this->getAvailableEnd() && $this->getCurrentTime() > $this->getAvailableEnd()) {
  909.             return true;
  910.         }
  911.         return false;
  912.     }
  913.     public function getIsShowPublic(): ?bool
  914.     {
  915.         return $this->isShowPublic;
  916.     }
  917.     public function setIsShowPublic(?bool $isShowPublic): self
  918.     {
  919.         $this->isShowPublic $isShowPublic;
  920.         return $this;
  921.     }
  922.     public function getBulletPoints(): ?array
  923.     {
  924.         if ($this->bulletPoints === null) {
  925.             $this->bulletPoints = [];
  926.         }
  927.         return $this->bulletPoints;
  928.     }
  929.     public function setBulletPoints(?array $bulletPoints): self
  930.     {
  931.         if (!is_array($bulletPoints)) {
  932.             return $this;
  933.         }
  934.         $this->bulletPoints $bulletPoints;
  935.         return $this;
  936.     }
  937.     public function getAllBulletPoints($locale 'en')
  938.     {
  939.         $bp = [];
  940.         foreach ($this->bulletPoints as $c) {
  941.             if (isset($c['translations'])) {
  942.                 foreach ($c['translations'] as $t) {
  943.                     if ($t['locale'] === $locale) {
  944.                         $bp[] = $t['info'];
  945.                     }
  946.                 }
  947.             }
  948.         }
  949.         return implode('</br>'$bp);
  950.     }
  951.     public function getIsCertificate(): ?bool
  952.     {
  953.         return $this->isCertificate;
  954.     }
  955.     public function setIsCertificate(?bool $isCertificate): self
  956.     {
  957.         $this->isCertificate $isCertificate;
  958.         return $this;
  959.     }
  960.     public function getCertificateTemplate(): ?CertificateTemplate
  961.     {
  962.         return $this->certificateTemplate;
  963.     }
  964.     public function setCertificateTemplate(?CertificateTemplate $certificateTemplate): self
  965.     {
  966.         $this->certificateTemplate $certificateTemplate;
  967.         return $this;
  968.     }
  969.     public function getCloneId()
  970.     {
  971.         return $this->cloneId;
  972.     }
  973.     public function setCloneId($cloneId)
  974.     {
  975.         $this->cloneId $cloneId;
  976.         return $this;
  977.     }
  978.     public function getIsPostEnable()
  979.     {
  980.         return true;
  981.     }
  982.     public function getPostPoster()
  983.     {
  984.         return $this->getImageName();
  985.     }
  986.     public function getMetadataTranslation()
  987.     {
  988.         $translations = [];
  989.         foreach ($this->getTranslations() as $translation) {
  990.             $translations[] = [
  991.                 $translation->getLocale() => [
  992.                     'title' => $translation->getName(),
  993.                     'description' => $translation->getDescription()
  994.                 ]
  995.             ];
  996.         }
  997.         return $translations;
  998.     }
  999.     public function getPostMetadata()
  1000.     {
  1001.         return [
  1002.             'elCourse' => [
  1003.                 'id' => $this->getId(),
  1004.                 'translations' => $this->getMetadataTranslation(),
  1005.                 'tags' => $this->getTagsArray(),
  1006.                 'elCourseCategory' => $this->getElCourseCategory() ? $this->getElCourseCategory()->getMeta() : null
  1007.             ]
  1008.         ];
  1009.     }
  1010.     public function getPostUserGroups()
  1011.     {
  1012.         return $this->getUserGroups();
  1013.     }
  1014.     public function getPostSubSource()
  1015.     {
  1016.         return Newsfeed::POSTSUBTYPE_ELCOURSE;
  1017.     }
  1018.     /**
  1019.      * Get the value of copyType
  1020.      */
  1021.     public function getCopyType()
  1022.     {
  1023.         return $this->copyType;
  1024.     }
  1025.     /**
  1026.      * Set the value of copyType
  1027.      *
  1028.      * @return  self
  1029.      */
  1030.     public function setCopyType($copyType)
  1031.     {
  1032.         $this->copyType $copyType;
  1033.         return $this;
  1034.     }
  1035.     /**
  1036.      * Get the value of sourceId
  1037.      */
  1038.     public function getSourceId()
  1039.     {
  1040.         return $this->sourceId;
  1041.     }
  1042.     /**
  1043.      * Set the value of sourceId
  1044.      *
  1045.      * @return  self
  1046.      */
  1047.     public function setSourceId($sourceId)
  1048.     {
  1049.         $this->sourceId $sourceId;
  1050.         return $this;
  1051.     }
  1052.     /**
  1053.      * Get the value of targetId
  1054.      */
  1055.     public function getTargetId()
  1056.     {
  1057.         return $this->targetId;
  1058.     }
  1059.     /**
  1060.      * Set the value of targetId
  1061.      *
  1062.      * @return  self
  1063.      */
  1064.     public function setTargetId($targetId)
  1065.     {
  1066.         $this->targetId $targetId;
  1067.         return $this;
  1068.     }
  1069.     /**
  1070.      * Get the value of copyLevel
  1071.      */
  1072.     public function getCopyLevel(): ?string
  1073.     {
  1074.         return $this->copyLevel;
  1075.     }
  1076.     /**
  1077.      * Set the value of copyLevel
  1078.      *
  1079.      * @return  self
  1080.      */
  1081.     public function setCopyLevel(?string $copyLevel)
  1082.     {
  1083.         $this->copyLevel $copyLevel;
  1084.         return $this;
  1085.     }
  1086.     public function isIsShowDate(): ?bool
  1087.     {
  1088.         return $this->isShowDate;
  1089.     }
  1090.     public function setIsShowDate(?bool $isShowDate): self
  1091.     {
  1092.         $this->isShowDate $isShowDate;
  1093.         return $this;
  1094.     }
  1095.     public function getCertificateProgress(): ?int
  1096.     {
  1097.         return $this->certificateProgress;
  1098.     }
  1099.     public function setCertificateProgress(?int $certificateProgress): self
  1100.     {
  1101.         $this->certificateProgress $certificateProgress;
  1102.         return $this;
  1103.     }
  1104.     /**
  1105.      * @Groups({"ElCourse:EL"})
  1106.      */
  1107.     public function getCntId()
  1108.     {
  1109.         return $this->container->getId();
  1110.     }
  1111.     /**
  1112.      * @Groups({"ElCourse:EL"})
  1113.      */
  1114.     public function getCategory()
  1115.     {
  1116.         return $this->getElCourseCategory();
  1117.     }
  1118.     /**
  1119.      * @return Collection<int, ElCourseCredit>
  1120.      */
  1121.     public function getElCourseCredits(): Collection
  1122.     {
  1123.         return $this->elCourseCredits;
  1124.     }
  1125.     public function addElCourseCredit(ElCourseCredit $elCourseCredit): self
  1126.     {
  1127.         if (!$this->elCourseCredits->contains($elCourseCredit)) {
  1128.             $this->elCourseCredits[] = $elCourseCredit;
  1129.             $elCourseCredit->setElCourse($this);
  1130.         }
  1131.         return $this;
  1132.     }
  1133.     public function removeElCourseCredit(ElCourseCredit $elCourseCredit): self
  1134.     {
  1135.         // if ($this->elCourseCredits->removeElement($elCourseCredit)) {
  1136.         //     // set the owning side to null (unless already changed)
  1137.         //     if ($elCourseCredit->getElCourse() === $this) {
  1138.         //         $elCourseCredit->setElCourse(null);
  1139.         //     }
  1140.         // }
  1141.         $this->elCourseCredits->removeElement($elCourseCredit);
  1142.         return $this;
  1143.     }
  1144.     public function getTotalCredit()
  1145.     {
  1146.         $total 0.0;
  1147.         foreach ($this->elCourseCredits as $c) {
  1148.             $total += (float) $c->getCreditPoint();
  1149.         }
  1150.         return $total;
  1151.     }
  1152.     public function getAllCredit()
  1153.     {
  1154.         $allCredit = [];
  1155.         foreach ($this->elCourseCredits as $c) {
  1156.             $allCredit[] = $c->getCreditCategory()->getName().': '.$c->getCreditPoint();
  1157.         }
  1158.         return implode('</br>'$allCredit);
  1159.     }
  1160.     public function getInstructor(): ?User
  1161.     {
  1162.         return $this->instructor;
  1163.     }
  1164.     public function setInstructor(?User $instructor): self
  1165.     {
  1166.         $this->instructor $instructor;
  1167.         return $this;
  1168.     }
  1169.     public function getOriginalPrice(): ?string
  1170.     {
  1171.         return $this->originalPrice;
  1172.     }
  1173.     public function setOriginalPrice(?string $originalPrice): self
  1174.     {
  1175.         $this->originalPrice $originalPrice;
  1176.         return $this;
  1177.     }
  1178.     public function getPrice(): ?string
  1179.     {
  1180.         return $this->price;
  1181.     }
  1182.     public function setPrice(?string $price): self
  1183.     {
  1184.         $this->price $price;
  1185.         return $this;
  1186.     }
  1187.     public function getTotalRating(): ?int
  1188.     {
  1189.         return $this->totalRating;
  1190.     }
  1191.     public function setTotalRating(?int $totalRating): self
  1192.     {
  1193.         $this->totalRating $totalRating;
  1194.         return $this;
  1195.     }
  1196.     public function getAverageRating(): ?string
  1197.     {
  1198.         return $this->averageRating;
  1199.     }
  1200.     public function setAverageRating(?string $averageRating): self
  1201.     {
  1202.         $this->averageRating $averageRating;
  1203.         return $this;
  1204.     }
  1205.     /**
  1206.      * @return Collection<int, ElCourseRating>
  1207.      */
  1208.     public function getElCourseRatings(): Collection
  1209.     {
  1210.         return $this->elCourseRatings;
  1211.     }
  1212.     public function addElCourseRating(ElCourseRating $elCourseRating): self
  1213.     {
  1214.         if (!$this->elCourseRatings->contains($elCourseRating)) {
  1215.             $this->elCourseRatings[] = $elCourseRating;
  1216.             $elCourseRating->setElCourse($this);
  1217.         }
  1218.         return $this;
  1219.     }
  1220.     public function removeElCourseRating(ElCourseRating $elCourseRating): self
  1221.     {
  1222.         if ($this->elCourseRatings->removeElement($elCourseRating)) {
  1223.             // set the owning side to null (unless already changed)
  1224.             if ($elCourseRating->getElCourse() === $this) {
  1225.                 $elCourseRating->setElCourse(null);
  1226.             }
  1227.         }
  1228.         return $this;
  1229.     }
  1230.     /**
  1231.      * @return Collection<int, ElCourseSaved>
  1232.      */
  1233.     public function getElCourseSaved(): Collection
  1234.     {
  1235.         return $this->elCourseSaved;
  1236.     }
  1237.     public function addElCourseSaved(ElCourseSaved $elCourseSaved): self
  1238.     {
  1239.         if (!$this->elCourseSaved->contains($elCourseSaved)) {
  1240.             $this->elCourseSaved[] = $elCourseSaved;
  1241.             $elCourseSaved->setElCourse($this);
  1242.         }
  1243.         return $this;
  1244.     }
  1245.     public function removeElCourseSaved(ElCourseSaved $elCourseSaved): self
  1246.     {
  1247.         if ($this->elCourseSaved->removeElement($elCourseSaved)) {
  1248.             // set the owning side to null (unless already changed)
  1249.             if ($elCourseSaved->getElCourse() === $this) {
  1250.                 $elCourseSaved->setElCourse(null);
  1251.             }
  1252.         }
  1253.         return $this;
  1254.     }
  1255.     /**
  1256.      * @return Collection<int, Company>
  1257.      */
  1258.     public function getCompanies(): Collection
  1259.     {
  1260.         return $this->companies;
  1261.     }
  1262.     public function addCompany(Company $company): self
  1263.     {
  1264.         if (!$this->companies->contains($company)) {
  1265.             $this->companies[] = $company;
  1266.         }
  1267.         return $this;
  1268.     }
  1269.     public function removeCompany(Company $company): self
  1270.     {
  1271.         $this->companies->removeElement($company);
  1272.         return $this;
  1273.     }
  1274. }