src/Entity/Product/Brand.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Product;
  3. use App\Repository\Product\BrandRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassBrandRepository::class)]
  8. class Brand
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column(length255)]
  15.     private ?string $name null;
  16.     #[ORM\OneToMany(mappedBy'brand'targetEntityProduct::class)]
  17.     private Collection $product;
  18.     #[ORM\Column(length255nullabletrue)]
  19.     private ?string $logo null;
  20.     #[ORM\Column(length255nullabletrue)]
  21.     private ?string $description null;
  22.     #[ORM\Column(length255nullabletrue)]
  23.     private ?string $website null;
  24.     public function __construct()
  25.     {
  26.         $this->product = new ArrayCollection();
  27.     }
  28.     public function __toString()
  29.     {
  30.         return $this->name;
  31.     }
  32.     public function getId(): ?int
  33.     {
  34.         return $this->id;
  35.     }
  36.     public function getName(): ?string
  37.     {
  38.         return $this->name;
  39.     }
  40.     public function setName(string $name): self
  41.     {
  42.         $this->name $name;
  43.         return $this;
  44.     }
  45.     /**
  46.      * @return Collection<int, Product>
  47.      */
  48.     public function getProduct(): Collection
  49.     {
  50.         return $this->product;
  51.     }
  52.     public function addProduct(Product $product): self
  53.     {
  54.         if (!$this->product->contains($product)) {
  55.             $this->product->add($product);
  56.             $product->setBrand($this);
  57.         }
  58.         return $this;
  59.     }
  60.     public function removeProduct(Product $product): self
  61.     {
  62.         if ($this->product->removeElement($product)) {
  63.             // set the owning side to null (unless already changed)
  64.             if ($product->getBrand() === $this) {
  65.                 $product->setBrand(null);
  66.             }
  67.         }
  68.         return $this;
  69.     }
  70.     public function getLogo(): ?string
  71.     {
  72.         return $this->logo;
  73.     }
  74.     public function setLogo(?string $logo): self
  75.     {
  76.         $this->logo $logo;
  77.         return $this;
  78.     }
  79.     public function getDescription(): ?string
  80.     {
  81.         return $this->description;
  82.     }
  83.     public function setDescription(?string $description): self
  84.     {
  85.         $this->description $description;
  86.         return $this;
  87.     }
  88.     public function getWebsite(): ?string
  89.     {
  90.         return $this->website;
  91.     }
  92.     public function setWebsite(?string $website): self
  93.     {
  94.         $this->website $website;
  95.         return $this;
  96.     }
  97. }