src/IlaveU/ShopBundle/Entity/Shipping/Country.php line 21
<?phpnamespace App\IlaveU\ShopBundle\Entity\Shipping;use ApiPlatform\Core\Annotation\ApiResource;use App\IlaveU\ShopBundle\Entity\Payment\PaymentMethod;use App\IlaveU\ShopBundle\Entity\Product\Product;use App\Repository\IlaveU\ShopBundle\Entity\Shipping\CountryRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Serializer\Annotation\Groups;#[ORM\Entity(repositoryClass: CountryRepository::class)]#[ApiResource(normalizationContext: ['groups' => ['read']],denormalizationContext: ['groups' => ['write']],)]class Country{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]#[Groups(['read', 'write'])]private ?int $id = null;#[Groups(['read', 'write'])]#[ORM\Column(length: 255, nullable: true)]private ?string $name = null;#[Groups(['read', 'write'])]#[ORM\Column(length: 255, nullable: true)]private ?string $code = null;#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $description = null;#[ORM\Column(nullable: true)]private ?bool $isEnabled = null;#[ORM\ManyToMany(targetEntity: ShippingMethod::class, mappedBy: 'countries')]private Collection $shippingMethods;#[ORM\ManyToMany(targetEntity: PaymentMethod::class, mappedBy: 'includedCountries')]private Collection $paymentMethods;#[ORM\ManyToMany(targetEntity: Product::class, mappedBy: 'shipToCountries')]private Collection $shippingProducts;public function __construct(){$this->shippingMethods = new ArrayCollection();$this->paymentMethods = new ArrayCollection();$this->shippingProducts = new ArrayCollection();}public function __toString(){return (string)$this->name;}public function getId(): ?int{return $this->id;}public function getName(): ?string{return $this->name;}public function setName(?string $name): static{$this->name = $name;return $this;}public function getCode(): ?string{return $this->code;}public function setCode(?string $code): static{$this->code = $code;return $this;}public function getDescription(): ?string{return $this->description;}public function setDescription(?string $description): static{$this->description = $description;return $this;}public function isIsEnabled(): ?bool{return $this->isEnabled;}public function setIsEnabled(?bool $isEnabled): static{$this->isEnabled = $isEnabled;return $this;}/*** @return Collection<int, ShippingMethod>*/public function getShippingMethods(): Collection{return $this->shippingMethods;}public function addShippingMethod(ShippingMethod $shippingMethod): static{if (!$this->shippingMethods->contains($shippingMethod)) {$this->shippingMethods->add($shippingMethod);}return $this;}public function removeShippingMethod(ShippingMethod $shippingMethod): static{$this->shippingMethods->removeElement($shippingMethod);return $this;}/*** @return Collection<int, PaymentMethod>*/public function getPaymentMethods(): Collection{return $this->paymentMethods;}public function addPaymentMethod(PaymentMethod $paymentMethod): static{if (!$this->paymentMethods->contains($paymentMethod)) {$this->paymentMethods->add($paymentMethod);$paymentMethod->addIncludedCountry($this);}return $this;}public function removePaymentMethod(PaymentMethod $paymentMethod): static{if ($this->paymentMethods->removeElement($paymentMethod)) {$paymentMethod->removeIncludedCountry($this);}return $this;}/*** @return Collection<int, Product>*/public function getShippingProducts(): Collection{return $this->shippingProducts;}public function addShippingProduct(Product $shippingProduct): static{if (!$this->shippingProducts->contains($shippingProduct)) {$this->shippingProducts->add($shippingProduct);$shippingProduct->addShipToCountry($this);}return $this;}public function removeShippingProduct(Product $shippingProduct): static{if ($this->shippingProducts->removeElement($shippingProduct)) {$shippingProduct->removeShipToCountry($this);}return $this;}}