src/Entity/Service.php line 15

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ServiceRepository;
  4. use App\Trait\ActivableTrait;
  5. use App\Trait\CurrentStateTrait;
  6. use App\Trait\DateTrait;
  7. use App\Trait\DeletableTrait;
  8. use DateTimeImmutable;
  9. use Doctrine\DBAL\Types\Types;
  10. use Doctrine\ORM\Mapping as ORM;
  11. #[ORM\Entity(repositoryClassServiceRepository::class)]
  12. class Service
  13. {
  14.     use DateTrait;
  15.     use ActivableTrait;
  16.     use CurrentStateTrait;
  17.     use DeletableTrait;
  18.     #[ORM\Id]
  19.     #[ORM\GeneratedValue]
  20.     #[ORM\Column]
  21.     private ?int $id null;
  22.     #[ORM\Column(length255)]
  23.     private ?string $name null;
  24.     #[ORM\Column(length255nullabletrue)]
  25.     private ?string $slug null;
  26.     #[ORM\Column(typeTypes::TEXT)]
  27.     private ?string $content null;
  28.     #[ORM\ManyToOne(cascade: ["persist"])]
  29.     #[ORM\JoinColumn(nullablefalse)]
  30.     private ?Attachment $thumbnail null;
  31.     #[ORM\Column]
  32.     private ?float $price null;
  33.     #[ORM\Column]
  34.     private ?bool $isPromote null;
  35.     #[ORM\Column(nullabletrue)]
  36.     private ?float $promotePrice null;
  37.     #[ORM\ManyToOne]
  38.     #[ORM\JoinColumn(nullablefalse)]
  39.     private ?Currency $currency null;
  40.     #[ORM\ManyToOne]
  41.     #[ORM\JoinColumn(nullablefalse)]
  42.     private ?Department $department null;
  43.     #[ORM\ManyToOne(inversedBy'services')]
  44.     #[ORM\JoinColumn(nullablefalse)]
  45.     private ?User $author null;
  46.     public function __construct()
  47.     {
  48.         if (is_null($this->createdAt)) $this->createdAt = new DateTimeImmutable();
  49.         $this->updatedAt = new DateTimeImmutable();
  50.     }
  51.     public function getId(): ?int
  52.     {
  53.         return $this->id;
  54.     }
  55.     /**
  56.      * @param int|null $id
  57.      *
  58.      * @return $this
  59.      */
  60.     public function setId(?int $id): self
  61.     {
  62.         $this->id $id;
  63.         return $this;
  64.     }
  65.     public function getName(): ?string
  66.     {
  67.         return $this->name;
  68.     }
  69.     public function setName(string $name): self
  70.     {
  71.         $this->name $name;
  72.         return $this;
  73.     }
  74.     public function getSlug(): ?string
  75.     {
  76.         return $this->slug;
  77.     }
  78.     public function setSlug(?string $slug): self
  79.     {
  80.         $this->slug $slug;
  81.         return $this;
  82.     }
  83.     public function getContent(): ?string
  84.     {
  85.         return $this->content;
  86.     }
  87.     public function setContent(string $content): self
  88.     {
  89.         $this->content $content;
  90.         return $this;
  91.     }
  92.     public function getThumbnail(): ?Attachment
  93.     {
  94.         return $this->thumbnail;
  95.     }
  96.     public function setThumbnail(?Attachment $thumbnail): self
  97.     {
  98.         $this->thumbnail $thumbnail;
  99.         return $this;
  100.     }
  101.     public function getAmount(): ?float
  102.     {
  103.         return $this->price;
  104.     }
  105.     public function setPrice(float $price): self
  106.     {
  107.         $this->price $price;
  108.         return $this;
  109.     }
  110.     public function isIsPromote(): ?bool
  111.     {
  112.         return $this->isPromote;
  113.     }
  114.     public function setIsPromote(bool $isPromote): self
  115.     {
  116.         $this->isPromote $isPromote;
  117.         return $this;
  118.     }
  119.     public function getPromotePrice(): ?float
  120.     {
  121.         return $this->promotePrice;
  122.     }
  123.     public function setPromotePrice(?float $promotePrice): self
  124.     {
  125.         $this->promotePrice $promotePrice;
  126.         return $this;
  127.     }
  128.     public function getCurrency(): ?Currency
  129.     {
  130.         return $this->currency;
  131.     }
  132.     public function setCurrency(?Currency $currency): self
  133.     {
  134.         $this->currency $currency;
  135.         return $this;
  136.     }
  137.     public function getDepartment(): ?Department
  138.     {
  139.         return $this->department;
  140.     }
  141.     public function setDepartment(?Department $department): self
  142.     {
  143.         $this->department $department;
  144.         return $this;
  145.     }
  146.     public function getAuthor(): ?User
  147.     {
  148.         return $this->author;
  149.     }
  150.     public function setAuthor(?User $author): self
  151.     {
  152.         $this->author $author;
  153.         return $this;
  154.     }
  155.     public function __toString(): string
  156.     {
  157.         return $this->name;
  158.     }
  159. }