src/Entity/TestType.php line 28

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\TestTypeRepository;
  4. use Doctrine\ORM\Mapping\UniqueConstraint;
  5. use Gedmo\Mapping\Annotation as Gedmo;
  6. use Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity;
  7. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use EightMarq\CoreComponent\Entity\BaseEntity;
  11. /**
  12.  * @ORM\Table(name="test_types", uniqueConstraints={
  13.  *      @UniqueConstraint(columns={"name", "deleted_at"})
  14.  * })
  15.  *
  16.  * @UniqueEntity(fields={"name"}, errorPath="name", message="error.entity.not_unique"))
  17.  *
  18.  * @ORM\Entity(repositoryClass=TestTypeRepository::class)
  19.  *
  20.  *
  21.  * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=true, hardDelete=false)
  22.  *
  23.  */
  24. class TestType extends BaseEntity
  25. {
  26.     /**
  27.      * @var string
  28.      *
  29.      * @ORM\Column(type="string", length=255)
  30.      *
  31.      * @Assert\NotBlank()
  32.      */
  33.     private $name;
  34.     public function getName(): ?string
  35.     {
  36.         return $this->name;
  37.     }
  38.     public function setName(string $name): self
  39.     {
  40.         $this->name $name;
  41.         return $this;
  42.     }
  43.     public function __toString()
  44.     {
  45.         return (string)$this->getName();
  46.     }
  47. }