src/Flexy/ShopBundle/Entity/Customer/ComplaintSubject.php line 14
<?php
namespace App\Flexy\ShopBundle\Entity\Customer;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Repository\Flexy\ShopBundle\Entity\Customer\ComplaintSubjectRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ComplaintSubjectRepository::class)]
#[ApiResource]
class ComplaintSubject
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $description = null;
#[ORM\OneToMany(mappedBy: 'complaintSubject', targetEntity: Complaint::class)]
private Collection $complaints;
public function __construct()
{
$this->complaints = new ArrayCollection();
}
public function __toString()
{
return $this->name;
}
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 getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
/**
* @return Collection<int, Complaint>
*/
public function getComplaints(): Collection
{
return $this->complaints;
}
public function addComplaint(Complaint $complaint): self
{
if (!$this->complaints->contains($complaint)) {
$this->complaints->add($complaint);
$complaint->setComplaintSubject($this);
}
return $this;
}
public function removeComplaint(Complaint $complaint): self
{
if ($this->complaints->removeElement($complaint)) {
// set the owning side to null (unless already changed)
if ($complaint->getComplaintSubject() === $this) {
$complaint->setComplaintSubject(null);
}
}
return $this;
}
}