src/Entity/Charity.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CharityRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. /**
  9.  * @ORM\Entity(repositoryClass=CharityRepository::class)
  10.  * @ORM\HasLifecycleCallbacks()
  11.  */
  12. class Charity
  13. {
  14.     use RemoveImageTrait;
  15.     /**
  16.      * @ORM\Id
  17.      * @ORM\GeneratedValue
  18.      * @ORM\Column(type="integer")
  19.      */
  20.     private $id;
  21.     /**
  22.      * @ORM\Column(type="string", length=255, nullable=true)
  23.      * @Assert\NotBlank()
  24.      */
  25.     private $image;
  26.     /**
  27.      * @ORM\Column(type="integer")
  28.      */
  29.     private $position 0;
  30.     /**
  31.      * @ORM\Column(type="boolean")
  32.      */
  33.     private $enabled false;
  34.     /**
  35.      * @ORM\Column(type="string", length=255)
  36.      */
  37.     private $name;
  38.     /**
  39.      * @ORM\OneToMany(targetEntity=SpeakerConsultation::class, mappedBy="charity")
  40.      */
  41.     private $consultations;
  42.     /**
  43.      * @ORM\Column(type="string", length=255, nullable=true)
  44.      * @Assert\NotBlank()
  45.      */
  46.     private $speakerOffer;
  47.     /**
  48.      * @ORM\Column(type="string", length=255, nullable=true)
  49.      * @Assert\NotBlank()
  50.      */
  51.     private $listenerOffer;
  52.     /**
  53.      * @ORM\Column(type="string", length=255, nullable=true)
  54.      * @Assert\NotBlank()
  55.      */
  56.     private $charityId;
  57.     /**
  58.      * @ORM\Column(type="string", length=255, nullable=true)
  59.      * @Assert\NotBlank()
  60.      */
  61.     private $charitySecret;
  62.     public function __construct()
  63.     {
  64.         $this->speakers = new ArrayCollection();
  65.     }
  66.     /**
  67.      * @ORM\PostRemove()
  68.      */
  69.     public function removeImageOnDelete()
  70.     {
  71.         $this->removeImage($this->getImage());
  72.     }
  73.     public function getId(): ?int
  74.     {
  75.         return $this->id;
  76.     }
  77.     public function getImage(): ?string
  78.     {
  79.         return $this->image;
  80.     }
  81.     public function setImage(string $image): self
  82.     {
  83.         $this->image $image;
  84.         return $this;
  85.     }
  86.     public function getPosition(): ?int
  87.     {
  88.         return $this->position;
  89.     }
  90.     public function setPosition(int $position): self
  91.     {
  92.         $this->position $position;
  93.         return $this;
  94.     }
  95.     public function getEnabled(): ?bool
  96.     {
  97.         return $this->enabled;
  98.     }
  99.     public function setEnabled(bool $enabled): self
  100.     {
  101.         $this->enabled $enabled;
  102.         return $this;
  103.     }
  104.     public function __toString(): string
  105.     {
  106.         return $this->getName();
  107.     }
  108.     public function getName(): ?string
  109.     {
  110.         return $this->name;
  111.     }
  112.     public function setName(string $name): self
  113.     {
  114.         $this->name $name;
  115.         return $this;
  116.     }
  117.     public function getConsultations()
  118.     {
  119.         return $this->consultations;
  120.     }
  121.     public function getSpeakerOffer(): ?string
  122.     {
  123.         return $this->speakerOffer;
  124.     }
  125.     public function setSpeakerOffer(?string $speakerOffer): self
  126.     {
  127.         $this->speakerOffer $speakerOffer;
  128.         return $this;
  129.     }
  130.     public function getListenerOffer(): ?string
  131.     {
  132.         return $this->listenerOffer;
  133.     }
  134.     public function setListenerOffer(?string $listenerOffer): self
  135.     {
  136.         $this->listenerOffer $listenerOffer;
  137.         return $this;
  138.     }
  139.     public function getCharityId(): ?string
  140.     {
  141.         return $this->charityId;
  142.     }
  143.     public function setCharityId(?string $charityId): self
  144.     {
  145.         $this->charityId $charityId;
  146.         return $this;
  147.     }
  148.     public function getCharitySecret(): ?string
  149.     {
  150.         return $this->charitySecret;
  151.     }
  152.     public function setCharitySecret($charitySecret): self
  153.     {
  154.         $this->charitySecret $charitySecret;
  155.         return $this;
  156.     }
  157. }