src/Supplier/Doctrine/Entity/Brand.php line 25

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Supplier\Doctrine\Entity;
  4. use App\Shop\Doctrine\Entity\Brand as BaseBrand;
  5. use App\Shop\Doctrine\Entity\Product;
  6. use App\Supplier\Doctrine\Repository\BrandRepository;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\ORM\Mapping\Column;
  10. use Doctrine\ORM\Mapping\Entity;
  11. use Doctrine\ORM\Mapping\GeneratedValue;
  12. use Doctrine\ORM\Mapping\Id;
  13. use Doctrine\ORM\Mapping\Index;
  14. use Doctrine\ORM\Mapping\JoinColumn;
  15. use Doctrine\ORM\Mapping\ManyToOne;
  16. use Doctrine\ORM\Mapping\OneToMany;
  17. use Doctrine\ORM\Mapping\Table;
  18. #[Entity(repositoryClassBrandRepository::class)]
  19. #[Table(name'supplier_brand')]
  20. #[Index(columns: ['name''supplier_id'], name'name_supplier_id')]
  21. class Brand
  22. {
  23.     #[Id]
  24.     #[Column(type'integer')]
  25.     #[GeneratedValue]
  26.     private ?int $id null;
  27.     #[Column]
  28.     private string $name;
  29.     #[ManyToOne(targetEntitySupplier::class)]
  30.     #[JoinColumn(nullablefalse)]
  31.     private Supplier $supplier;
  32.     #[ManyToOne(targetEntityBaseBrand::class)]
  33.     private ?BaseBrand $brand null;
  34.     private ?string $baseName null;
  35.     /**
  36.      * @var Collection<array-key, Product>
  37.      */
  38.     #[OneToMany(mappedBy'supplierBrand'targetEntityProduct::class)]
  39.     private Collection $products;
  40.     public function __construct()
  41.     {
  42.         $this->products = new ArrayCollection();
  43.     }
  44.     public function getId(): ?int
  45.     {
  46.         return $this->id;
  47.     }
  48.     public function getName(): string
  49.     {
  50.         return $this->name;
  51.     }
  52.     public function setName(string $name): void
  53.     {
  54.         $this->name $name;
  55.     }
  56.     public function getSupplier(): Supplier
  57.     {
  58.         return $this->supplier;
  59.     }
  60.     public function setSupplier(Supplier $supplier): void
  61.     {
  62.         $this->supplier $supplier;
  63.     }
  64.     public function getBrand(): ?BaseBrand
  65.     {
  66.         return $this->brand;
  67.     }
  68.     public function setBrand(?BaseBrand $brand): void
  69.     {
  70.         $this->brand $brand;
  71.     }
  72.     /**
  73.      * @return Collection<array-key, Product>
  74.      */
  75.     public function getProducts(): Collection
  76.     {
  77.         return $this->products;
  78.     }
  79.     public function getBaseName(): ?string
  80.     {
  81.         return $this->baseName;
  82.     }
  83.     public function setBaseName(?string $baseName): void
  84.     {
  85.         $this->baseName $baseName;
  86.     }
  87. }