src/Entity/Product.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProductRepository;
  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. #[ORM\Entity(repositoryClassProductRepository::class)]
  9. #[ORM\Index(columns: ['ean''project_id'], name'product_ean_project_idx')]
  10. class Product
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column]
  15.     private ?int $id null;
  16.     #[ORM\Column(length500nullabletrue)]
  17.     private ?string $name null;
  18.     #[ORM\Column]
  19.     private ?bool $inCatalog null;
  20.     #[ORM\Column(length50)]
  21.     private ?string $ean null;
  22.     #[ORM\ManyToOne(targetEntityProject::class)]
  23.     private ?Project $project null;
  24.     #[ORM\ManyToOne(targetEntityBrand::class, cascade: ['persist'])]
  25.     #[ORM\JoinColumn(nullabletrue)]
  26.     private ?Brand $brand null;
  27.     #[ORM\Column]
  28.     private ?\DateTime $lastUpdate null;
  29.     #[ORM\OneToMany(mappedBy'product'targetEntityRecord::class)]
  30.     private Collection $records;
  31.     #[ORM\Column(length255nullabletrue)]
  32.     private ?string $photo null;
  33.     #[ORM\Column(typeTypes::BLOBnullabletrue)]
  34.     private $photomini;
  35.     public function __construct()
  36.     {
  37.         $this->records = new ArrayCollection();
  38.         $this->name '';
  39.     }
  40.     public function getName(): ?string
  41.     {
  42.         return $this->name;
  43.     }
  44.     public function setName(string $name): static
  45.     {
  46.         $this->name $name;
  47.         return $this;
  48.     }
  49.     public function getProject(): ?Project
  50.     {
  51.         return $this->project;
  52.     }
  53.     public function setProject(?Project $project): static
  54.     {
  55.         $this->project $project;
  56.         return $this;
  57.     }
  58.     public function getBrand(): ?Brand
  59.     {
  60.         return $this->brand;
  61.     }
  62.     public function setBrand(?Brand $brand): static
  63.     {
  64.         $this->brand $brand;
  65.         return $this;
  66.     }
  67.     public function isInCatalog(): ?bool
  68.     {
  69.         return $this->inCatalog;
  70.     }
  71.     public function setInCatalog(bool $inCatalog): static
  72.     {
  73.         $this->inCatalog $inCatalog;
  74.         return $this;
  75.     }
  76.     public function getEan(): ?string
  77.     {
  78.         return $this->ean;
  79.     }
  80.     public function setEan(string $ean): static
  81.     {
  82.         $this->ean $ean;
  83.         return $this;
  84.     }
  85.     public function getLastUpdate(): ?\DateTimeInterface
  86.     {
  87.         return $this->lastUpdate;
  88.     }
  89.     public function setLastUpdate(\DateTime $lastUpdate): static
  90.     {
  91.         $this->lastUpdate $lastUpdate;
  92.         return $this;
  93.     }
  94.     public function getId(): ?int
  95.     {
  96.         return $this->id;
  97.     }
  98.     /**
  99.      * @return Collection<int, Record>
  100.      */
  101.     public function getRecords(): Collection
  102.     {
  103.         return $this->records;
  104.     }
  105.     public function addRecord(Record $record): static
  106.     {
  107.         if (!$this->records->contains($record)) {
  108.             $this->records->add($record);
  109.             $record->setProduct($this);
  110.         }
  111.         return $this;
  112.     }
  113.     public function removeRecord(Record $record): static
  114.     {
  115.         if ($this->records->removeElement($record)) {
  116.             // set the owning side to null (unless already changed)
  117.             if ($record->getProduct() === $this) {
  118.                 $record->setProduct(null);
  119.             }
  120.         }
  121.         return $this;
  122.     }
  123.     public function getPhoto(): ?string
  124.     {
  125.         return $this->photo;
  126.     }
  127.     public function setPhoto(?string $photo): static
  128.     {
  129.         $this->photo $photo;
  130.         return $this;
  131.     }
  132.     public function getPhotomini()
  133.     {
  134.         return $this->photomini;
  135.     }
  136.     public function setPhotomini($photomini): static
  137.     {
  138.         $this->photomini $photomini;
  139.         return $this;
  140.     }
  141. }