<?php
namespace App\Entity;
use App\Repository\CampusRepository;
use App\Traits\EntityDateTimeAbleTrait;
use App\Traits\SeoTrait;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: CampusRepository::class)]
#[ORM\HasLifecycleCallbacks]
class Campus
{
use EntityDateTimeAbleTrait;
use SeoTrait;
const STATUS_ACTIVE = 1;
const STATUS_INACTIVE = 0;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255)]
private ?string $name = null;
#[ORM\Column(type: 'string', length: 255)]
private $slug;
#[ORM\Column(type: 'integer')]
private ?int $status = null;
#[ORM\Column(type: 'integer', nullable: true)]
private ?int $ordering = null;
#[ORM\ManyToMany(targetEntity: User::class, mappedBy: 'campuses')]
private Collection $users;
#[ORM\OneToMany(targetEntity: Profile::class, mappedBy: 'campus')]
private Collection $profiles;
#[ORM\ManyToMany(targetEntity: Program::class, mappedBy: 'campuses')]
private Collection $programs;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $city = null;
#[ORM\OneToOne(targetEntity: Media::class, cascade: ['persist', 'remove'])]
private ?\App\Entity\Media $logo = null;
#[ORM\ManyToMany(targetEntity: Media::class, orphanRemoval: true, cascade: ['persist', 'remove'])]
private Collection $images;
#[ORM\Column(type: 'json', nullable: true)]
private ?array $youtubeUrl = [];
#[ORM\OneToMany(targetEntity: CampusCenter::class, mappedBy: 'campus', orphanRemoval: true, cascade: ['persist', 'remove'])]
private Collection $campusCenters;
#[ORM\OneToMany(targetEntity: CampusPresentationBlock::class, mappedBy: 'campus', orphanRemoval: true, cascade: ['persist', 'remove'])]
private Collection $presentationBlocks;
#[ORM\OneToMany(targetEntity: CampusArticle::class, mappedBy: 'campus', orphanRemoval: true, cascade: ['persist', 'remove'])]
private Collection $articles;
#[ORM\OneToMany(targetEntity: CampusKeyFigure::class, mappedBy: 'campus', orphanRemoval: true, cascade: ['persist', 'remove'])]
private Collection $keyFigures;
#[ORM\ManyToMany(targetEntity: Offer::class, mappedBy: 'campuses')]
private Collection $offers;
#[ORM\OneToMany(targetEntity: Candidate::class, mappedBy: 'campus')]
private Collection $candidates;
#[ORM\OneToOne(targetEntity: Media::class, cascade: ['persist', 'remove'])]
private ?\App\Entity\Media $imageDepiction = null;
#[ORM\OneToMany(targetEntity: Participate::class, mappedBy: 'campus')]
private Collection $participates;
#[ORM\OneToMany(mappedBy: 'campus', targetEntity: OpenDayPerson::class)]
private Collection $openDayPeople;
#[ORM\ManyToMany(targetEntity: Forum::class, mappedBy: 'campuses')]
private Collection $forums;
public function __construct()
{
$this->users = new ArrayCollection();
$this->profiles = new ArrayCollection();
$this->programs = new ArrayCollection();
$this->images = new ArrayCollection();
$this->campusCenters = new ArrayCollection();
$this->presentationBlocks = new ArrayCollection();
$this->articles = new ArrayCollection();
$this->keyFigures = new ArrayCollection();
$this->offers = new ArrayCollection();
$this->candidates = new ArrayCollection();
$this->participates = new ArrayCollection();
$this->openDayPeople = new ArrayCollection();
$this->forums = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(string $slug): self
{
$this->slug = $slug;
return $this;
}
public function getStatus(): ?int
{
return $this->status;
}
public function setStatus(int $status): self
{
$this->status = $status;
return $this;
}
public function getOrdering(): ?int
{
return $this->ordering;
}
public function setOrdering(?int $ordering): self
{
$this->ordering = $ordering;
return $this;
}
/**
* @return Collection<int, User>
*/
public function getUsers(): Collection
{
return $this->users;
}
public function addUser(User $user): self
{
if (!$this->users->contains($user)) {
$this->users[] = $user;
$user->addCampus($this);
}
return $this;
}
public function removeUser(User $user): self
{
if ($this->users->removeElement($user)) {
$user->removeCampus($this);
}
return $this;
}
/**
* @return Collection<int, Profile>
*/
public function getProfiles(): Collection
{
return $this->profiles;
}
public function addProfile(Profile $profile): self
{
if (!$this->profiles->contains($profile)) {
$this->profiles[] = $profile;
$profile->setCampus($this);
}
return $this;
}
public function removeProfile(Profile $profile): self
{
if ($this->profiles->removeElement($profile)) {
// set the owning side to null (unless already changed)
if ($profile->getCampus() === $this) {
$profile->setCampus(null);
}
}
return $this;
}
/**
* @return Collection<int, Program>
*/
public function getPrograms(): Collection
{
return $this->programs;
}
public function addProgram(Program $program): self
{
if (!$this->programs->contains($program)) {
$this->programs[] = $program;
$program->addCampus($this);
}
return $this;
}
public function removeProgram(Program $program): self
{
if ($this->programs->removeElement($program)) {
$program->removeCampus($this);
}
return $this;
}
public function getCity(): ?string
{
return $this->city;
}
public function setCity(string $city): self
{
$this->city = $city;
return $this;
}
public function getLogo(): ?Media
{
return $this->logo;
}
public function setLogo(?Media $logo): self
{
$this->logo = $logo;
return $this;
}
/**
* @return Collection<int, Media>
*/
public function getImages(): Collection
{
return $this->images;
}
public function addImage(Media $image): self
{
if (!$this->images->contains($image)) {
$this->images[] = $image;
}
return $this;
}
public function removeImage(Media $image): self
{
$this->images->removeElement($image);
return $this;
}
public function getYoutubeUrl(): ?array
{
return $this->youtubeUrl;
}
public function setYoutubeUrl(?array $youtubeUrl): self
{
$this->youtubeUrl = $youtubeUrl;
return $this;
}
/**
* @return Collection<int, CampusCenter>
*/
public function getCampusCenters(): Collection
{
return $this->campusCenters;
}
public function addCampusCenter(CampusCenter $campusCenter): self
{
if (!$this->campusCenters->contains($campusCenter)) {
$this->campusCenters[] = $campusCenter;
$campusCenter->setCampus($this);
}
return $this;
}
public function removeCampusCenter(CampusCenter $campusCenter): self
{
if ($this->campusCenters->removeElement($campusCenter)) {
// set the owning side to null (unless already changed)
if ($campusCenter->getCampus() === $this) {
$campusCenter->setCampus(null);
}
}
return $this;
}
/**
* @return Collection<int, CampusPresentationBlock>
*/
public function getPresentationBlocks(): Collection
{
return $this->presentationBlocks;
}
public function addPresentationBlock(CampusPresentationBlock $presentationBlock): self
{
if (!$this->presentationBlocks->contains($presentationBlock)) {
$this->presentationBlocks[] = $presentationBlock;
$presentationBlock->setCampus($this);
}
return $this;
}
public function removePresentationBlock(CampusPresentationBlock $presentationBlock): self
{
if ($this->presentationBlocks->removeElement($presentationBlock)) {
// set the owning side to null (unless already changed)
if ($presentationBlock->getCampus() === $this) {
$presentationBlock->setCampus(null);
}
}
return $this;
}
/**
* @return Collection<int, CampusArticle>
*/
public function getArticles(): Collection
{
return $this->articles;
}
public function addArticle(CampusArticle $article): self
{
if (!$this->articles->contains($article)) {
$this->articles[] = $article;
$article->setCampus($this);
}
return $this;
}
public function removeArticle(CampusArticle $article): self
{
if ($this->articles->removeElement($article)) {
// set the owning side to null (unless already changed)
if ($article->getCampus() === $this) {
$article->setCampus(null);
}
}
return $this;
}
/**
* @return Collection<int, CampusKeyFigure>
*/
public function getKeyFigures(): Collection
{
return $this->keyFigures;
}
public function addKeyFigure(CampusKeyFigure $keyFigure): self
{
if (!$this->keyFigures->contains($keyFigure)) {
$this->keyFigures[] = $keyFigure;
$keyFigure->setCampus($this);
}
return $this;
}
public function removeKeyFigure(CampusKeyFigure $keyFigure): self
{
if ($this->keyFigures->removeElement($keyFigure)) {
// set the owning side to null (unless already changed)
if ($keyFigure->getCampus() === $this) {
$keyFigure->setCampus(null);
}
}
return $this;
}
/**
* @return Collection<int, Offer>
*/
public function getOffers(): Collection
{
return $this->offers;
}
public function addOffer(Offer $offer): self
{
if (!$this->offers->contains($offer)) {
$this->offers[] = $offer;
$offer->addCampus($this);
}
return $this;
}
public function removeOffer(Offer $offer): self
{
if ($this->offers->removeElement($offer)) {
$offer->removeCampus($this);
}
return $this;
}
/**
* @return Collection<int, Candidate>
*/
public function getCandidates(): Collection
{
return $this->candidates;
}
public function addCandidate(Candidate $candidate): self
{
if (!$this->candidates->contains($candidate)) {
$this->candidates[] = $candidate;
$candidate->setCampus($this);
}
return $this;
}
public function removeCandidate(Candidate $candidate): self
{
if ($this->candidates->removeElement($candidate)) {
// set the owning side to null (unless already changed)
if ($candidate->getCampus() === $this) {
$candidate->setCampus(null);
}
}
return $this;
}
public function getImageDepiction(): ?Media
{
return $this->imageDepiction;
}
public function setImageDepiction(?Media $imageDepiction): self
{
$this->imageDepiction = $imageDepiction;
return $this;
}
/**
* @return Collection<int, Participate>
*/
public function getParticipates(): Collection
{
return $this->participates;
}
public function addParticipate(Participate $participate): self
{
if (!$this->participates->contains($participate)) {
$this->participates[] = $participate;
$participate->setCampus($this);
}
return $this;
}
public function removeParticipate(Participate $participate): self
{
if ($this->participates->removeElement($participate)) {
// set the owning side to null (unless already changed)
if ($participate->getCampus() === $this) {
$participate->setCampus(null);
}
}
return $this;
}
/**
* @return Collection<int, OpenDayPerson>
*/
public function getOpenDayPeople(): Collection
{
return $this->openDayPeople;
}
public function addOpenDayPerson(OpenDayPerson $openDayPerson): static
{
if (!$this->openDayPeople->contains($openDayPerson)) {
$this->openDayPeople->add($openDayPerson);
$openDayPerson->setCampus($this);
}
return $this;
}
public function removeOpenDayPerson(OpenDayPerson $openDayPerson): static
{
if ($this->openDayPeople->removeElement($openDayPerson)) {
// set the owning side to null (unless already changed)
if ($openDayPerson->getCampus() === $this) {
$openDayPerson->setCampus(null);
}
}
return $this;
}
/**
* @return Collection<int, Forum>
*/
public function getForums(): Collection
{
return $this->forums;
}
public function addForum(Forum $forum): static
{
if (!$this->forums->contains($forum)) {
$this->forums->add($forum);
$forum->addCampus($this);
}
return $this;
}
public function removeForum(Forum $forum): static
{
if ($this->forums->removeElement($forum)) {
$forum->removeCampus($this);
}
return $this;
}
}