<?php
namespace App\Entity;
use App\Repository\CharityRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass=CharityRepository::class)
* @ORM\HasLifecycleCallbacks()
*/
class Charity
{
use RemoveImageTrait;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Assert\NotBlank()
*/
private $image;
/**
* @ORM\Column(type="integer")
*/
private $position = 0;
/**
* @ORM\Column(type="boolean")
*/
private $enabled = false;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\OneToMany(targetEntity=SpeakerConsultation::class, mappedBy="charity")
*/
private $consultations;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Assert\NotBlank()
*/
private $speakerOffer;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Assert\NotBlank()
*/
private $listenerOffer;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Assert\NotBlank()
*/
private $charityId;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Assert\NotBlank()
*/
private $charitySecret;
public function __construct()
{
$this->speakers = new ArrayCollection();
}
/**
* @ORM\PostRemove()
*/
public function removeImageOnDelete()
{
$this->removeImage($this->getImage());
}
public function getId(): ?int
{
return $this->id;
}
public function getImage(): ?string
{
return $this->image;
}
public function setImage(string $image): self
{
$this->image = $image;
return $this;
}
public function getPosition(): ?int
{
return $this->position;
}
public function setPosition(int $position): self
{
$this->position = $position;
return $this;
}
public function getEnabled(): ?bool
{
return $this->enabled;
}
public function setEnabled(bool $enabled): self
{
$this->enabled = $enabled;
return $this;
}
public function __toString(): string
{
return $this->getName();
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getConsultations()
{
return $this->consultations;
}
public function getSpeakerOffer(): ?string
{
return $this->speakerOffer;
}
public function setSpeakerOffer(?string $speakerOffer): self
{
$this->speakerOffer = $speakerOffer;
return $this;
}
public function getListenerOffer(): ?string
{
return $this->listenerOffer;
}
public function setListenerOffer(?string $listenerOffer): self
{
$this->listenerOffer = $listenerOffer;
return $this;
}
public function getCharityId(): ?string
{
return $this->charityId;
}
public function setCharityId(?string $charityId): self
{
$this->charityId = $charityId;
return $this;
}
public function getCharitySecret(): ?string
{
return $this->charitySecret;
}
public function setCharitySecret($charitySecret): self
{
$this->charitySecret = $charitySecret;
return $this;
}
}