src/Supplier/Doctrine/Entity/Taxonomy.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\Product;
  5. use App\Shop\Doctrine\Entity\Taxonomy as BaseTaxonomy;
  6. use App\Supplier\Doctrine\Repository\TaxonomyRepository;
  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(repositoryClassTaxonomyRepository::class)]
  19. #[Table(name'supplier_taxonomy')]
  20. #[Index(columns: ['hash''supplier_id'], name'hash_supplier_id')]
  21. class Taxonomy
  22. {
  23.     #[Id]
  24.     #[Column(type'integer')]
  25.     #[GeneratedValue]
  26.     private ?int $id null;
  27.     #[Column]
  28.     private string $hash;
  29.     #[Column]
  30.     private string $name;
  31.     /**
  32.      * @var array<array-key, string>
  33.      */
  34.     #[Column(type'array')]
  35.     private array $hierarchy = [];
  36.     #[ManyToOne(targetEntitySupplier::class)]
  37.     #[JoinColumn(nullablefalse)]
  38.     private Supplier $supplier;
  39.     #[ManyToOne(targetEntityBaseTaxonomy::class)]
  40.     private ?BaseTaxonomy $taxonomy null;
  41.     /**
  42.      * @var Collection<array-key, Product>
  43.      */
  44.     #[OneToMany(mappedBy'supplierTaxonomy'targetEntityProduct::class)]
  45.     private Collection $products;
  46.     public function __construct()
  47.     {
  48.         $this->products = new ArrayCollection();
  49.     }
  50.     public function getId(): ?int
  51.     {
  52.         return $this->id;
  53.     }
  54.     public function getHash(): string
  55.     {
  56.         return $this->hash;
  57.     }
  58.     public function setHash(string $hash): void
  59.     {
  60.         $this->hash $hash;
  61.     }
  62.     public function getName(): string
  63.     {
  64.         return $this->name;
  65.     }
  66.     public function setName(string $name): void
  67.     {
  68.         $this->name $name;
  69.     }
  70.     /**
  71.      * @return array<array-key, string>
  72.      */
  73.     public function getHierarchy(): array
  74.     {
  75.         return $this->hierarchy;
  76.     }
  77.     /**
  78.      * @param array<array-key, string> $hierarchy
  79.      */
  80.     public function setHierarchy(array $hierarchy): void
  81.     {
  82.         $this->hierarchy $hierarchy;
  83.     }
  84.     public function getSupplier(): Supplier
  85.     {
  86.         return $this->supplier;
  87.     }
  88.     public function setSupplier(Supplier $supplier): void
  89.     {
  90.         $this->supplier $supplier;
  91.     }
  92.     public function getTaxonomy(): ?BaseTaxonomy
  93.     {
  94.         return $this->taxonomy;
  95.     }
  96.     public function setTaxonomy(?BaseTaxonomy $taxonomy): void
  97.     {
  98.         $this->taxonomy $taxonomy;
  99.     }
  100.     /**
  101.      * @return Collection<array-key, Product>
  102.      */
  103.     public function getProducts(): Collection
  104.     {
  105.         return $this->products;
  106.     }
  107. }