src/Flexy/ShopBundle/Entity/Customer/ComplaintSubject.php line 14

  1. <?php
  2. namespace App\Flexy\ShopBundle\Entity\Customer;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Repository\Flexy\ShopBundle\Entity\Customer\ComplaintSubjectRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. #[ORM\Entity(repositoryClassComplaintSubjectRepository::class)]
  10. #[ApiResource]
  11. class ComplaintSubject
  12. {
  13.     #[ORM\Id]
  14.     #[ORM\GeneratedValue]
  15.     #[ORM\Column]
  16.     private ?int $id null;
  17.     #[ORM\Column(length255)]
  18.     private ?string $name null;
  19.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  20.     private ?string $description null;
  21.     #[ORM\OneToMany(mappedBy'complaintSubject'targetEntityComplaint::class)]
  22.     private Collection $complaints;
  23.     public function __construct()
  24.     {
  25.         $this->complaints = new ArrayCollection();
  26.     }
  27.     public function __toString()
  28.     {
  29.         return $this->name;
  30.     }
  31.     public function getId(): ?int
  32.     {
  33.         return $this->id;
  34.     }
  35.     public function getName(): ?string
  36.     {
  37.         return $this->name;
  38.     }
  39.     public function setName(string $name): self
  40.     {
  41.         $this->name $name;
  42.         return $this;
  43.     }
  44.     public function getDescription(): ?string
  45.     {
  46.         return $this->description;
  47.     }
  48.     public function setDescription(?string $description): self
  49.     {
  50.         $this->description $description;
  51.         return $this;
  52.     }
  53.     /**
  54.      * @return Collection<int, Complaint>
  55.      */
  56.     public function getComplaints(): Collection
  57.     {
  58.         return $this->complaints;
  59.     }
  60.     public function addComplaint(Complaint $complaint): self
  61.     {
  62.         if (!$this->complaints->contains($complaint)) {
  63.             $this->complaints->add($complaint);
  64.             $complaint->setComplaintSubject($this);
  65.         }
  66.         return $this;
  67.     }
  68.     public function removeComplaint(Complaint $complaint): self
  69.     {
  70.         if ($this->complaints->removeElement($complaint)) {
  71.             // set the owning side to null (unless already changed)
  72.             if ($complaint->getComplaintSubject() === $this) {
  73.                 $complaint->setComplaintSubject(null);
  74.             }
  75.         }
  76.         return $this;
  77.     }
  78. }