src/Shop/Doctrine/Entity/Shop.php line 26

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Shop\Doctrine\Entity;
  4. use App\Program\Doctrine\Entity\Profile;
  5. use App\Shop\Doctrine\Entity\Filter\Filter;
  6. use App\Shop\Doctrine\Repository\ShopRepository;
  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\JoinTable;
  14. use Doctrine\ORM\Mapping\ManyToMany;
  15. use Doctrine\ORM\Mapping\OneToMany;
  16. use Doctrine\ORM\Mapping\Table;
  17. use Symfony\Component\Validator\Constraints\Count as CountAssert;
  18. use Symfony\Component\Validator\Constraints\NotNull;
  19. use Symfony\Component\Validator\Constraints\Valid;
  20. #[Entity(repositoryClassShopRepository::class)]
  21. #[Table(name'`shop`')]
  22. class Shop
  23. {
  24.     #[Id]
  25.     #[Column(type'integer')]
  26.     #[GeneratedValue]
  27.     private ?int $id null;
  28.     /**
  29.      * @var Collection<array-key, Profile>
  30.      */
  31.     #[ManyToMany(targetEntityProfile::class)]
  32.     #[JoinTable(name'`shop_profiles`')]
  33.     #[CountAssert(min1)]
  34.     private Collection $profiles;
  35.     #[Column(type'price_valuation')]
  36.     #[Valid]
  37.     #[NotNull]
  38.     private PriceValuation $priceValuation;
  39.     /**
  40.      * @var Collection<array-key, Filter>
  41.      */
  42.     #[OneToMany(mappedBy'shop'targetEntityFilter::class, cascade: ['persist'])]
  43.     private Collection $filters;
  44.     private int $numberOfProducts 0;
  45.     public function __construct()
  46.     {
  47.         $this->profiles = new ArrayCollection();
  48.         $this->filters = new ArrayCollection();
  49.     }
  50.     public function getId(): ?int
  51.     {
  52.         return $this->id;
  53.     }
  54.     /**
  55.      * @return Collection<array-key, Profile>
  56.      */
  57.     public function getProfiles(): Collection
  58.     {
  59.         return $this->profiles;
  60.     }
  61.     public function getPriceValuation(): PriceValuation
  62.     {
  63.         return $this->priceValuation;
  64.     }
  65.     public function setPriceValuation(PriceValuation $priceValuation): void
  66.     {
  67.         $this->priceValuation $priceValuation;
  68.     }
  69.     /**
  70.      * @return Collection<array-key, Filter>
  71.      */
  72.     public function getFilters(): Collection
  73.     {
  74.         return $this->filters;
  75.     }
  76.     public function getNumberOfProducts(): int
  77.     {
  78.         return $this->numberOfProducts;
  79.     }
  80.     public function setNumberOfProducts(int $numberOfProducts): void
  81.     {
  82.         $this->numberOfProducts $numberOfProducts;
  83.     }
  84. }