src/Entity/Record.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\RecordRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Serializer\Annotation\Ignore;
  9. #[ORM\Entity(repositoryClassRecordRepository::class)]
  10. class Record
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column]
  15.     private ?int $id null;
  16.     #[ORM\Column(typeTypes::DATETIME_IMMUTABLE)]
  17.     private ?\DateTimeImmutable $recordTime null;
  18.     #[ORM\Column(typeTypes::DATETIME_IMMUTABLE)]
  19.     private ?\DateTimeImmutable $syncTime null;
  20.     #[ORM\Column]
  21.     private ?float $price null;
  22.     #[ORM\ManyToOne(targetEntityProduct::class, inversedBy'records'cascade: ['persist'])]
  23.     private ?Product $product null;
  24.     #[ORM\ManyToOne(targetEntityShop::class, cascade: ['persist'])]
  25.     #[Ignore]
  26.     private ?Shop $shop null;
  27.     #[ORM\Column(length255)]
  28.     private ?string $contentHash '';
  29.     #[ORM\OneToMany(mappedBy'record'targetEntityPhoto::class, cascade: ['persist''remove'])]
  30.     private Collection $photos;
  31.     #[ORM\ManyToOne(targetEntityUser::class)]
  32.     private ?User $user null;
  33.     #[ORM\Column(type'text'nullabletrue)]
  34.     private ?string $photoConcat null;
  35.     public function __construct()
  36.     {
  37.         $this->photos = new ArrayCollection();
  38.     }
  39.     public function getId(): ?int
  40.     {
  41.         return $this->id;
  42.     }
  43.     public function getPrice(): ?float
  44.     {
  45.         return $this->price;
  46.     }
  47.     public function setPrice(float $price): static
  48.     {
  49.         $this->price $price;
  50.         return $this;
  51.     }
  52.     public function getShop(): ?Shop
  53.     {
  54.         return $this->shop;
  55.     }
  56.     public function setShop(?Shop $shop): static
  57.     {
  58.         $this->shop $shop;
  59.         return $this;
  60.     }
  61.     public function getRecordTime(): ?\DateTimeImmutable
  62.     {
  63.         return $this->recordTime;
  64.     }
  65.     public function setRecordTime(\DateTimeImmutable $recordTime): static
  66.     {
  67.         $this->recordTime $recordTime;
  68.         return $this;
  69.     }
  70.     public function getSyncTime(): ?\DateTimeImmutable
  71.     {
  72.         return $this->syncTime;
  73.     }
  74.     public function setSyncTime(\DateTimeImmutable $syncTime): static
  75.     {
  76.         $this->syncTime $syncTime;
  77.         return $this;
  78.     }
  79.     public function getContentHash(): ?string
  80.     {
  81.         return $this->contentHash;
  82.     }
  83.     public function setContentHash(string $contentHash): static
  84.     {
  85.         $this->contentHash $contentHash;
  86.         return $this;
  87.     }
  88.     public function getUser(): ?User
  89.     {
  90.         return $this->user;
  91.     }
  92.     public function setUser(?User $user): static
  93.     {
  94.         $this->user $user;
  95.         return $this;
  96.     }
  97.     /**
  98.      * @return Collection<int, Photo>
  99.      */
  100.     public function getPhotos(): Collection
  101.     {
  102.         return $this->photos;
  103.     }
  104.     public function addPhoto(Photo $photo): static
  105.     {
  106.         if (!$this->photos->contains($photo)) {
  107.             $this->photos->add($photo);
  108.             $photo->setRecord($this);
  109.         }
  110.         return $this;
  111.     }
  112.     public function removePhoto(Photo $photo): static
  113.     {
  114.         if ($this->photos->removeElement($photo)) {
  115.             // set the owning side to null (unless already changed)
  116.             if ($photo->getRecord() === $this) {
  117.                 $photo->setRecord(null);
  118.             }
  119.         }
  120.         return $this;
  121.     }
  122.     public function getProduct(): ?Product
  123.     {
  124.         return $this->product;
  125.     }
  126.     public function setProduct(?Product $product): static
  127.     {
  128.         $this->product $product;
  129.         return $this;
  130.     }
  131.     public function getPhotoConcat(): ?string
  132.     {
  133.         return $this->photoConcat;
  134.     }
  135.     public function setPhotoConcat(?string $photoConcat): static
  136.     {
  137.         $this->photoConcat $photoConcat;
  138.         return $this;
  139.     }
  140. }