src/Entity/Partner.php line 14
<?php
namespace App\Entity;
use App\Repository\PartnerRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Uid\Uuid;
#[ORM\Entity(repositoryClass: PartnerRepository::class)]
class Partner
{
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\Column(type: 'uuid', unique: true)]
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
private ?Uuid $id = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
#[ORM\Column(length: 191, unique: true)]
#[Gedmo\Slug(fields: ['name'])]
private ?string $slug = null;
#[ORM\ManyToOne(inversedBy: 'partners')]
private ?PartnerType $type = null;
#[ORM\OneToMany(mappedBy: 'partner', targetEntity: Course::class)]
private Collection $courses;
#[ORM\OneToOne(cascade: ['persist'])]
#[ORM\JoinColumn(onDelete: 'CASCADE')]
private ?Image $logo = null;
#[ORM\OneToOne(cascade: ['persist'])]
#[ORM\JoinColumn(onDelete: 'CASCADE')]
private ?Image $image = null;
#[ORM\Column(length: 255)]
private ?string $location = null;
#[ORM\OneToMany(mappedBy: 'initiator', targetEntity: Challenge::class)]
private Collection $challenges;
#[ORM\ManyToMany(targetEntity: Challenge::class, mappedBy: 'partners')]
private Collection $partner_challenges;
#[ORM\Column(type: Types::TEXT)]
private ?string $full_description = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $link = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $link_text = null;
#[ORM\ManyToOne]
private ?ContactPerson $contact_person = null;
public function __construct()
{
$this->courses = new ArrayCollection();
$this->challenges = new ArrayCollection();
$this->partner_challenges = new ArrayCollection();
}
public function __toString() {
return $this->name;
}
public function getId(): ?Uuid
{
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 getType(): ?PartnerType
{
return $this->type;
}
public function setType(?PartnerType $type): self
{
$this->type = $type;
return $this;
}
/**
* @return Collection<int, Course>
*/
public function getCourses(): Collection
{
return $this->courses;
}
public function addCourse(Course $course): self
{
if (!$this->courses->contains($course)) {
$this->courses->add($course);
$course->setPartner($this);
}
return $this;
}
public function removeCourse(Course $course): self
{
if ($this->courses->removeElement($course)) {
// set the owning side to null (unless already changed)
if ($course->getPartner() === $this) {
$course->setPartner(null);
}
}
return $this;
}
public function getLogo(): ?Image
{
return $this->logo;
}
public function setLogo(?Image $logo): self
{
$this->logo = $logo;
return $this;
}
public function getImage(): ?Image
{
return $this->image;
}
public function setImage(?Image $image): self
{
$this->image = $image;
return $this;
}
public function getLocation(): ?string
{
return $this->location;
}
public function setLocation(string $location): self
{
$this->location = $location;
return $this;
}
/**
* @return Collection<int, Challenge>
*/
public function getChallenges(): Collection
{
return $this->challenges;
}
public function addChallenge(Challenge $challenge): self
{
if (!$this->challenges->contains($challenge)) {
$this->challenges->add($challenge);
$challenge->setInitiator($this);
}
return $this;
}
public function removeChallenge(Challenge $challenge): self
{
if ($this->challenges->removeElement($challenge)) {
// set the owning side to null (unless already changed)
if ($challenge->getInitiator() === $this) {
$challenge->setInitiator(null);
}
}
return $this;
}
/**
* @return Collection<int, Challenge>
*/
public function getPartnerChallenges(): Collection
{
return $this->partner_challenges;
}
public function addPartnerChallenge(Challenge $partnerChallenge): self
{
if (!$this->partner_challenges->contains($partnerChallenge)) {
$this->partner_challenges->add($partnerChallenge);
$partnerChallenge->addPartner($this);
}
return $this;
}
public function removePartnerChallenge(Challenge $partnerChallenge): self
{
if ($this->partner_challenges->removeElement($partnerChallenge)) {
$partnerChallenge->removePartner($this);
}
return $this;
}
public function getContactPerson(): ?ContactPerson
{
return $this->contact_person;
}
public function setContactPerson(?ContactPerson $contact_person): self
{
$this->contact_person = $contact_person;
return $this;
}
/**
* @return string|null
*/
public function getFullDescription(): ?string
{
return $this->full_description;
}
/**
* @param string|null $full_description
*/
public function setFullDescription(?string $full_description): void
{
$this->full_description = $full_description;
}
/**
* @return string|null
*/
public function getLink(): ?string
{
return $this->link;
}
/**
* @param string|null $link
*/
public function setLink(?string $link): void
{
$this->link = $link;
}
/**
* @return string|null
*/
public function getLinkText(): ?string
{
return $this->link_text;
}
/**
* @param string|null $link_text
*/
public function setLinkText(?string $link_text): void
{
$this->link_text = $link_text;
}
}