src/Entity/FileData.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\FileDataRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Gedmo\Timestampable\Traits\TimestampableEntity;
  6. #[ORM\Entity(repositoryClassFileDataRepository::class)]
  7. class FileData
  8. {
  9.     public const IMAGE_NOT_AVAILABLE_PATH "/uploads/image_not_available.webp";
  10.     use TimestampableEntity;
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column(type'integer')]
  14.     private $id;
  15.     #[ORM\Column(type'string'length128)]
  16.     private ?string $name;
  17.     #[ORM\Column(type'string'length128)]
  18.     private ?string $directoryPath;
  19.     #[ORM\Column(type'string'length32)]
  20.     private ?string $extension;
  21.     #[ORM\Column(type'string'length255nullabletrue)]
  22.     private ?string $alt;
  23.     #[ORM\ManyToOne(targetEntityProvider::class, inversedBy'images')]
  24.     private ?Provider $provider;
  25.     #[ORM\Column(type'smallint'nullabletrue)]
  26.     private mixed $displayOrder;
  27.     #[ORM\Column(length255nullabletrue)]
  28.     private ?string $url null;
  29.     #[ORM\Column]
  30.     private ?bool $active null;
  31.     #[ORM\Column(length255nullabletrue)]
  32.     private ?string $title null;
  33.     #[ORM\Column(length255nullabletrue)]
  34.     private ?string $sub_title null;
  35.     //  , columnDefinition:"ENUM('hotel','slider')"  // Error :  Unknown database type enum requested, Doctrine\DBAL\Platforms\MySQLPlatform may not support it.
  36.     #[ORM\Column(length255nullabletrue)]
  37.     private  ?string $type;
  38.     #[ORM\ManyToOne(inversedBy'images')]
  39.     private ?Product $product null;
  40.     #[ORM\OneToOne(mappedBy'logo'cascade: ['persist''remove'])]
  41.     private ?Airline $airline null;
  42.     public function __construct()
  43.     {
  44.         $this->active true;
  45.     }
  46.     public function getId(): ?int
  47.     {
  48.         return $this->id;
  49.     }
  50.     public function getName(): ?string
  51.     {
  52.         return $this->name;
  53.     }
  54.     public function setName(string $name): self
  55.     {
  56.         $this->name $name;
  57.         return $this;
  58.     }
  59.     public function getDirectoryPath(): ?string
  60.     {
  61.         return $this->directoryPath;
  62.     }
  63.     public function setDirectoryPath(string $directoryPath): self
  64.     {
  65.         $this->directoryPath $directoryPath;
  66.         return $this;
  67.     }
  68.     public function getPath(): ?string{
  69.         return $this->getDirectoryPath().'/'.$this->name;
  70.     }
  71.     public function getExtension(): ?string
  72.     {
  73.         return $this->extension;
  74.     }
  75.     public function setExtension(string $extension): self
  76.     {
  77.         $this->extension $extension;
  78.         return $this;
  79.     }
  80.     public function getAlt(): ?string
  81.     {
  82.         return $this->alt;
  83.     }
  84.     public function setAlt(?string $alt): self
  85.     {
  86.         $this->alt $alt;
  87.         return $this;
  88.     }
  89.     public function getProvider(): ?Provider
  90.     {
  91.         return $this->provider;
  92.     }
  93.     public function setProvider(?Provider $provider): self
  94.     {
  95.         $this->provider $provider;
  96.         return $this;
  97.     }
  98.     /**
  99.      * @return mixed
  100.      */
  101.     public function getDisplayOrder()
  102.     {
  103.         return $this->displayOrder;
  104.     }
  105.     /**
  106.      * @param mixed $displayOrder
  107.      */
  108.     public function setDisplayOrder(mixed $displayOrder): void
  109.     {
  110.         $this->displayOrder $displayOrder;
  111.     }
  112.     public function __toString()
  113.     {
  114.         return $this->name;
  115.     }
  116.     public function getUrl(): ?string
  117.     {
  118.         return $this->url;
  119.     }
  120.     public function setUrl(?string $url): self
  121.     {
  122.         $this->url $url;
  123.         return $this;
  124.     }
  125.     public function isActive(): ?bool
  126.     {
  127.         return $this->active;
  128.     }
  129.     public function setActive(bool $active): self
  130.     {
  131.         $this->active $active;
  132.         return $this;
  133.     }
  134.     public function getTitle(): ?string
  135.     {
  136.         return $this->title;
  137.     }
  138.     public function setTitle(?string $title): self
  139.     {
  140.         $this->title $title;
  141.         return $this;
  142.     }
  143.     public function getSubTitle(): ?string
  144.     {
  145.         return $this->sub_title;
  146.     }
  147.     public function setSubTitle(?string $sub_title): self
  148.     {
  149.         $this->sub_title $sub_title;
  150.         return $this;
  151.     }
  152.     /**
  153.      * @param string|null $type
  154.      */
  155.     public function setType(?string $type): void
  156.     {
  157.         $this->type $type;
  158.     }
  159.     /**
  160.      * @return string|null
  161.      */
  162.     public function getType(): ?string
  163.     {
  164.         return $this->type;
  165.     }
  166.     public function getProduct(): ?Product
  167.     {
  168.         return $this->product;
  169.     }
  170.     public function setProduct(?Product $product): static
  171.     {
  172.         $this->product $product;
  173.         return $this;
  174.     }
  175.     public function getAirline(): ?Airline
  176.     {
  177.         return $this->airline;
  178.     }
  179.     public function setAirline(?Airline $airline): static
  180.     {
  181.         // unset the owning side of the relation if necessary
  182.         if ($airline === null && $this->airline !== null) {
  183.             $this->airline->setLogo(null);
  184.         }
  185.         // set the owning side of the relation if necessary
  186.         if ($airline !== null && $airline->getLogo() !== $this) {
  187.             $airline->setLogo($this);
  188.         }
  189.         $this->airline $airline;
  190.         return $this;
  191.     }
  192. }