src/Entity/Campus.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CampusRepository;
  4. use App\Traits\EntityDateTimeAbleTrait;
  5. use App\Traits\SeoTrait;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. #[ORM\Entity(repositoryClassCampusRepository::class)]
  10. #[ORM\HasLifecycleCallbacks]
  11. class Campus
  12. {
  13.     use EntityDateTimeAbleTrait;
  14.     use SeoTrait;
  15.     const STATUS_ACTIVE 1;
  16.     const STATUS_INACTIVE 0;
  17.     #[ORM\Id]
  18.     #[ORM\GeneratedValue]
  19.     #[ORM\Column(type'integer')]
  20.     private $id;
  21.     #[ORM\Column(type'string'length255)]
  22.     private ?string $name null;
  23.     #[ORM\Column(type'string'length255)]
  24.     private $slug;
  25.     #[ORM\Column(type'integer')]
  26.     private ?int $status null;
  27.     #[ORM\Column(type'integer'nullabletrue)]
  28.     private ?int $ordering null;
  29.     #[ORM\ManyToMany(targetEntityUser::class, mappedBy'campuses')]
  30.     private Collection $users;
  31.     #[ORM\OneToMany(targetEntityProfile::class, mappedBy'campus')]
  32.     private Collection $profiles;
  33.     #[ORM\ManyToMany(targetEntityProgram::class, mappedBy'campuses')]
  34.     private Collection $programs;
  35.     #[ORM\Column(type'string'length255nullabletrue)]
  36.     private ?string $city null;
  37.     #[ORM\OneToOne(targetEntityMedia::class, cascade: ['persist''remove'])]
  38.     private ?\App\Entity\Media $logo null;
  39.     #[ORM\ManyToMany(targetEntityMedia::class, orphanRemovaltruecascade: ['persist''remove'])]
  40.     private Collection $images;
  41.     #[ORM\Column(type'json'nullabletrue)]
  42.     private ?array $youtubeUrl = [];
  43.     #[ORM\OneToMany(targetEntityCampusCenter::class, mappedBy'campus'orphanRemovaltruecascade: ['persist''remove'])]
  44.     private Collection $campusCenters;
  45.     #[ORM\OneToMany(targetEntityCampusPresentationBlock::class, mappedBy'campus'orphanRemovaltruecascade: ['persist''remove'])]
  46.     private Collection $presentationBlocks;
  47.     #[ORM\OneToMany(targetEntityCampusArticle::class, mappedBy'campus'orphanRemovaltruecascade: ['persist''remove'])]
  48.     private Collection $articles;
  49.     #[ORM\OneToMany(targetEntityCampusKeyFigure::class, mappedBy'campus'orphanRemovaltruecascade: ['persist''remove'])]
  50.     private Collection $keyFigures;
  51.     #[ORM\ManyToMany(targetEntityOffer::class, mappedBy'campuses')]
  52.     private Collection $offers;
  53.     #[ORM\OneToMany(targetEntityCandidate::class, mappedBy'campus')]
  54.     private Collection $candidates;
  55.     #[ORM\OneToOne(targetEntityMedia::class, cascade: ['persist''remove'])]
  56.     private ?\App\Entity\Media $imageDepiction null;
  57.     #[ORM\OneToMany(targetEntityParticipate::class, mappedBy'campus')]
  58.     private Collection $participates;
  59.     #[ORM\OneToMany(mappedBy'campus'targetEntityOpenDayPerson::class)]
  60.     private Collection $openDayPeople;
  61.     #[ORM\ManyToMany(targetEntityForum::class, mappedBy'campuses')]
  62.     private Collection $forums;
  63.     public function __construct()
  64.     {
  65.         $this->users = new ArrayCollection();
  66.         $this->profiles = new ArrayCollection();
  67.         $this->programs = new ArrayCollection();
  68.         $this->images = new ArrayCollection();
  69.         $this->campusCenters = new ArrayCollection();
  70.         $this->presentationBlocks = new ArrayCollection();
  71.         $this->articles = new ArrayCollection();
  72.         $this->keyFigures = new ArrayCollection();
  73.         $this->offers = new ArrayCollection();
  74.         $this->candidates = new ArrayCollection();
  75.         $this->participates = new ArrayCollection();
  76.         $this->openDayPeople = new ArrayCollection();
  77.         $this->forums = new ArrayCollection();
  78.     }
  79.     public function getId(): ?int
  80.     {
  81.         return $this->id;
  82.     }
  83.     public function getName(): ?string
  84.     {
  85.         return $this->name;
  86.     }
  87.     public function setName(string $name): self
  88.     {
  89.         $this->name $name;
  90.         return $this;
  91.     }
  92.     public function getSlug(): ?string
  93.     {
  94.         return $this->slug;
  95.     }
  96.     public function setSlug(string $slug): self
  97.     {
  98.         $this->slug $slug;
  99.         return $this;
  100.     }
  101.     public function getStatus(): ?int
  102.     {
  103.         return $this->status;
  104.     }
  105.     public function setStatus(int $status): self
  106.     {
  107.         $this->status $status;
  108.         return $this;
  109.     }
  110.     public function getOrdering(): ?int
  111.     {
  112.         return $this->ordering;
  113.     }
  114.     public function setOrdering(?int $ordering): self
  115.     {
  116.         $this->ordering $ordering;
  117.         return $this;
  118.     }
  119.     /**
  120.      * @return Collection<int, User>
  121.      */
  122.     public function getUsers(): Collection
  123.     {
  124.         return $this->users;
  125.     }
  126.     public function addUser(User $user): self
  127.     {
  128.         if (!$this->users->contains($user)) {
  129.             $this->users[] = $user;
  130.             $user->addCampus($this);
  131.         }
  132.         return $this;
  133.     }
  134.     public function removeUser(User $user): self
  135.     {
  136.         if ($this->users->removeElement($user)) {
  137.             $user->removeCampus($this);
  138.         }
  139.         return $this;
  140.     }
  141.     /**
  142.      * @return Collection<int, Profile>
  143.      */
  144.     public function getProfiles(): Collection
  145.     {
  146.         return $this->profiles;
  147.     }
  148.     public function addProfile(Profile $profile): self
  149.     {
  150.         if (!$this->profiles->contains($profile)) {
  151.             $this->profiles[] = $profile;
  152.             $profile->setCampus($this);
  153.         }
  154.         return $this;
  155.     }
  156.     public function removeProfile(Profile $profile): self
  157.     {
  158.         if ($this->profiles->removeElement($profile)) {
  159.             // set the owning side to null (unless already changed)
  160.             if ($profile->getCampus() === $this) {
  161.                 $profile->setCampus(null);
  162.             }
  163.         }
  164.         return $this;
  165.     }
  166.     /**
  167.      * @return Collection<int, Program>
  168.      */
  169.     public function getPrograms(): Collection
  170.     {
  171.         return $this->programs;
  172.     }
  173.     public function addProgram(Program $program): self
  174.     {
  175.         if (!$this->programs->contains($program)) {
  176.             $this->programs[] = $program;
  177.             $program->addCampus($this);
  178.         }
  179.         return $this;
  180.     }
  181.     public function removeProgram(Program $program): self
  182.     {
  183.         if ($this->programs->removeElement($program)) {
  184.             $program->removeCampus($this);
  185.         }
  186.         return $this;
  187.     }
  188.     public function getCity(): ?string
  189.     {
  190.         return $this->city;
  191.     }
  192.     public function setCity(string $city): self
  193.     {
  194.         $this->city $city;
  195.         return $this;
  196.     }
  197.     public function getLogo(): ?Media
  198.     {
  199.         return $this->logo;
  200.     }
  201.     public function setLogo(?Media $logo): self
  202.     {
  203.         $this->logo $logo;
  204.         return $this;
  205.     }
  206.     /**
  207.      * @return Collection<int, Media>
  208.      */
  209.     public function getImages(): Collection
  210.     {
  211.         return $this->images;
  212.     }
  213.     public function addImage(Media $image): self
  214.     {
  215.         if (!$this->images->contains($image)) {
  216.             $this->images[] = $image;
  217.         }
  218.         return $this;
  219.     }
  220.     public function removeImage(Media $image): self
  221.     {
  222.         $this->images->removeElement($image);
  223.         return $this;
  224.     }
  225.     public function getYoutubeUrl(): ?array
  226.     {
  227.         return $this->youtubeUrl;
  228.     }
  229.     public function setYoutubeUrl(?array $youtubeUrl): self
  230.     {
  231.         $this->youtubeUrl $youtubeUrl;
  232.         return $this;
  233.     }
  234.     /**
  235.      * @return Collection<int, CampusCenter>
  236.      */
  237.     public function getCampusCenters(): Collection
  238.     {
  239.         return $this->campusCenters;
  240.     }
  241.     public function addCampusCenter(CampusCenter $campusCenter): self
  242.     {
  243.         if (!$this->campusCenters->contains($campusCenter)) {
  244.             $this->campusCenters[] = $campusCenter;
  245.             $campusCenter->setCampus($this);
  246.         }
  247.         return $this;
  248.     }
  249.     public function removeCampusCenter(CampusCenter $campusCenter): self
  250.     {
  251.         if ($this->campusCenters->removeElement($campusCenter)) {
  252.             // set the owning side to null (unless already changed)
  253.             if ($campusCenter->getCampus() === $this) {
  254.                 $campusCenter->setCampus(null);
  255.             }
  256.         }
  257.         return $this;
  258.     }
  259.     /**
  260.      * @return Collection<int, CampusPresentationBlock>
  261.      */
  262.     public function getPresentationBlocks(): Collection
  263.     {
  264.         return $this->presentationBlocks;
  265.     }
  266.     public function addPresentationBlock(CampusPresentationBlock $presentationBlock): self
  267.     {
  268.         if (!$this->presentationBlocks->contains($presentationBlock)) {
  269.             $this->presentationBlocks[] = $presentationBlock;
  270.             $presentationBlock->setCampus($this);
  271.         }
  272.         return $this;
  273.     }
  274.     public function removePresentationBlock(CampusPresentationBlock $presentationBlock): self
  275.     {
  276.         if ($this->presentationBlocks->removeElement($presentationBlock)) {
  277.             // set the owning side to null (unless already changed)
  278.             if ($presentationBlock->getCampus() === $this) {
  279.                 $presentationBlock->setCampus(null);
  280.             }
  281.         }
  282.         return $this;
  283.     }
  284.     /**
  285.      * @return Collection<int, CampusArticle>
  286.      */
  287.     public function getArticles(): Collection
  288.     {
  289.         return $this->articles;
  290.     }
  291.     public function addArticle(CampusArticle $article): self
  292.     {
  293.         if (!$this->articles->contains($article)) {
  294.             $this->articles[] = $article;
  295.             $article->setCampus($this);
  296.         }
  297.         return $this;
  298.     }
  299.     public function removeArticle(CampusArticle $article): self
  300.     {
  301.         if ($this->articles->removeElement($article)) {
  302.             // set the owning side to null (unless already changed)
  303.             if ($article->getCampus() === $this) {
  304.                 $article->setCampus(null);
  305.             }
  306.         }
  307.         return $this;
  308.     }
  309.     /**
  310.      * @return Collection<int, CampusKeyFigure>
  311.      */
  312.     public function getKeyFigures(): Collection
  313.     {
  314.         return $this->keyFigures;
  315.     }
  316.     public function addKeyFigure(CampusKeyFigure $keyFigure): self
  317.     {
  318.         if (!$this->keyFigures->contains($keyFigure)) {
  319.             $this->keyFigures[] = $keyFigure;
  320.             $keyFigure->setCampus($this);
  321.         }
  322.         return $this;
  323.     }
  324.     public function removeKeyFigure(CampusKeyFigure $keyFigure): self
  325.     {
  326.         if ($this->keyFigures->removeElement($keyFigure)) {
  327.             // set the owning side to null (unless already changed)
  328.             if ($keyFigure->getCampus() === $this) {
  329.                 $keyFigure->setCampus(null);
  330.             }
  331.         }
  332.         return $this;
  333.     }
  334.     /**
  335.      * @return Collection<int, Offer>
  336.      */
  337.     public function getOffers(): Collection
  338.     {
  339.         return $this->offers;
  340.     }
  341.     public function addOffer(Offer $offer): self
  342.     {
  343.         if (!$this->offers->contains($offer)) {
  344.             $this->offers[] = $offer;
  345.             $offer->addCampus($this);
  346.         }
  347.         return $this;
  348.     }
  349.     public function removeOffer(Offer $offer): self
  350.     {
  351.         if ($this->offers->removeElement($offer)) {
  352.             $offer->removeCampus($this);
  353.         }
  354.         return $this;
  355.     }
  356.     /**
  357.      * @return Collection<int, Candidate>
  358.      */
  359.     public function getCandidates(): Collection
  360.     {
  361.         return $this->candidates;
  362.     }
  363.     public function addCandidate(Candidate $candidate): self
  364.     {
  365.         if (!$this->candidates->contains($candidate)) {
  366.             $this->candidates[] = $candidate;
  367.             $candidate->setCampus($this);
  368.         }
  369.         return $this;
  370.     }
  371.     public function removeCandidate(Candidate $candidate): self
  372.     {
  373.         if ($this->candidates->removeElement($candidate)) {
  374.             // set the owning side to null (unless already changed)
  375.             if ($candidate->getCampus() === $this) {
  376.                 $candidate->setCampus(null);
  377.             }
  378.         }
  379.         return $this;
  380.     }
  381.     public function getImageDepiction(): ?Media
  382.     {
  383.         return $this->imageDepiction;
  384.     }
  385.     public function setImageDepiction(?Media $imageDepiction): self
  386.     {
  387.         $this->imageDepiction $imageDepiction;
  388.         return $this;
  389.     }
  390.     /**
  391.      * @return Collection<int, Participate>
  392.      */
  393.     public function getParticipates(): Collection
  394.     {
  395.         return $this->participates;
  396.     }
  397.     public function addParticipate(Participate $participate): self
  398.     {
  399.         if (!$this->participates->contains($participate)) {
  400.             $this->participates[] = $participate;
  401.             $participate->setCampus($this);
  402.         }
  403.         return $this;
  404.     }
  405.     public function removeParticipate(Participate $participate): self
  406.     {
  407.         if ($this->participates->removeElement($participate)) {
  408.             // set the owning side to null (unless already changed)
  409.             if ($participate->getCampus() === $this) {
  410.                 $participate->setCampus(null);
  411.             }
  412.         }
  413.         return $this;
  414.     }
  415.     /**
  416.      * @return Collection<int, OpenDayPerson>
  417.      */
  418.     public function getOpenDayPeople(): Collection
  419.     {
  420.         return $this->openDayPeople;
  421.     }
  422.     public function addOpenDayPerson(OpenDayPerson $openDayPerson): static
  423.     {
  424.         if (!$this->openDayPeople->contains($openDayPerson)) {
  425.             $this->openDayPeople->add($openDayPerson);
  426.             $openDayPerson->setCampus($this);
  427.         }
  428.         return $this;
  429.     }
  430.     public function removeOpenDayPerson(OpenDayPerson $openDayPerson): static
  431.     {
  432.         if ($this->openDayPeople->removeElement($openDayPerson)) {
  433.             // set the owning side to null (unless already changed)
  434.             if ($openDayPerson->getCampus() === $this) {
  435.                 $openDayPerson->setCampus(null);
  436.             }
  437.         }
  438.         return $this;
  439.     }
  440.     /**
  441.      * @return Collection<int, Forum>
  442.      */
  443.     public function getForums(): Collection
  444.     {
  445.         return $this->forums;
  446.     }
  447.     public function addForum(Forum $forum): static
  448.     {
  449.         if (!$this->forums->contains($forum)) {
  450.             $this->forums->add($forum);
  451.             $forum->addCampus($this);
  452.         }
  453.         return $this;
  454.     }
  455.     public function removeForum(Forum $forum): static
  456.     {
  457.         if ($this->forums->removeElement($forum)) {
  458.             $forum->removeCampus($this);
  459.         }
  460.         return $this;
  461.     }
  462. }