src/Entity/VehicleImage.php line 23

  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use ApiPlatform\Metadata\Get;
  5. use App\Repository\VehicleImageRepository;
  6. use DateTimeInterface;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Symfony\Component\Serializer\Annotation\Groups;
  10. #[ApiResource(
  11.     operations: [
  12.         new Get(),
  13.     ],
  14.     normalizationContext: ['groups' => ['img:read']],
  15.     security"is_granted('PUBLIC_ACCESS')"
  16. )]
  17. #[ORM\Entity(repositoryClassVehicleImageRepository::class)]
  18. class VehicleImage
  19. {
  20.     #[ORM\Id]
  21.     #[ORM\GeneratedValue]
  22.     #[ORM\Column]
  23.     private ?int $id null;
  24.     #[Groups(['vehicle:read''img:read'])]
  25.     #[ORM\Column(length255)]
  26.     private ?string $name null;
  27.     #[Groups(['vehicle:read''img:read'])]
  28.     #[ORM\Column(type'boolean'nullabletrue)]
  29.     private ?bool $main null;
  30.     #[ORM\ManyToOne(cascade: ['persist'], inversedBy'vehicleImages')]
  31.     private ?Vehicle $vehicle null;
  32.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  33.     private ?DateTimeInterface $createAt null;
  34.     #[ORM\Column(length500nullabletrue)]
  35.     private ?string $seoFilename null;
  36.     #[ORM\Column(length255nullabletrue)]
  37.     private ?string $altText null;
  38.     public function getId(): ?int
  39.     {
  40.         return $this->id;
  41.     }
  42.     public function getName(): ?string
  43.     {
  44.         return $this->name;
  45.     }
  46.     public function setName(string $name): self
  47.     {
  48.         $this->name $name;
  49.         return $this;
  50.     }
  51.     public function isMain(): ?bool
  52.     {
  53.         return $this->main;
  54.     }
  55.     public function setMain(bool $main): self
  56.     {
  57.         $this->main $main;
  58.         return $this;
  59.     }
  60.     public function getVehicle(): ?Vehicle
  61.     {
  62.         return $this->vehicle;
  63.     }
  64.     public function setVehicle(?Vehicle $vehicle): self
  65.     {
  66.         $this->vehicle $vehicle;
  67.         return $this;
  68.     }
  69.     public function getCreateAt(): ?DateTimeInterface
  70.     {
  71.         return $this->createAt;
  72.     }
  73.     public function setCreateAt(DateTimeInterface|null $createAt null): self
  74.     {
  75.         $this->createAt $createAt;
  76.         return $this;
  77.     }
  78.     public function getSeoFilename(): ?string
  79.     {
  80.         return $this->seoFilename;
  81.     }
  82.     public function setSeoFilename(?string $seoFilename): self
  83.     {
  84.         $this->seoFilename $seoFilename;
  85.         return $this;
  86.     }
  87.     public function getAltText(): ?string
  88.     {
  89.         return $this->altText;
  90.     }
  91.     public function setAltText(?string $altText): self
  92.     {
  93.         $this->altText $altText;
  94.         return $this;
  95.     }
  96. }