src/Entity/Item.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ItemRepository;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity(repositoryClassItemRepository::class)]
  7. class Item
  8. {
  9.     #[ORM\Id]
  10.     #[ORM\GeneratedValue]
  11.     #[ORM\Column]
  12.     private ?int $id null;
  13.     #[ORM\Column(length255)]
  14.     private ?string $code null;
  15.     #[ORM\Column(length255)]
  16.     private ?string $name null;
  17.     #[ORM\Column]
  18.     private ?bool $is_active null;
  19.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  20.     private ?string $details null;
  21.     #[ORM\Column(length255nullabletrue)]
  22.     private ?string $image null;
  23.     public function getId(): ?int
  24.     {
  25.         return $this->id;
  26.     }
  27.     public function getCode(): ?string
  28.     {
  29.         return $this->code;
  30.     }
  31.     public function setCode(string $code): static
  32.     {
  33.         $this->code $code;
  34.         return $this;
  35.     }
  36.     public function getName(): ?string
  37.     {
  38.         return $this->name;
  39.     }
  40.     public function setName(string $name): static
  41.     {
  42.         $this->name $name;
  43.         return $this;
  44.     }
  45.     public function isIsActive(): ?bool
  46.     {
  47.         return $this->is_active;
  48.     }
  49.     public function setIsActive(bool $is_active): static
  50.     {
  51.         $this->is_active $is_active;
  52.         return $this;
  53.     }
  54.     public function getDetails(): ?string
  55.     {
  56.         return $this->details;
  57.     }
  58.     public function setDetails(?string $details): static
  59.     {
  60.         $this->details $details;
  61.         return $this;
  62.     }
  63.     public function getImage(): ?string
  64.     {
  65.         return $this->image;
  66.     }
  67.     public function setImage(?string $image): static
  68.     {
  69.         $this->image $image;
  70.         return $this;
  71.     }
  72.     public function getImageUrl(): ?string
  73.     {
  74.         if (!$this->image) {
  75.             return null;
  76.         }
  77.         if (strpos($this->image'/') !== false) {
  78.             return $this->image;
  79.         }
  80.         return sprintf('/uploads/items/%s'$this->image);
  81.     }
  82. }