src/Entity/SaasConfiguration.php line 14

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SaasConfigurationRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
  8. use Symfony\Component\Validator\Constraints\NotNull;
  9. use Symfony\Component\Validator\Constraints\Valid;
  10. #[ORM\Entity(repositoryClassSaasConfigurationRepository::class)]
  11. class SaasConfiguration
  12. {
  13.     #[ORM\Id]
  14.     #[ORM\GeneratedValue]
  15.     #[ORM\Column]
  16.     private ?int $id null;
  17.     #[ORM\OneToOne(inversedBy'limits'cascade: ['persist''remove'])]
  18.     #[ORM\JoinColumn(nullablefalse)]
  19.     private ?SriInfo $company null;
  20.     #[ORM\Column(nullabletrue)]
  21.     private ?bool $showTransporter null;
  22.     #[ORM\Column(nullabletrue)]
  23.     #[NotNull]
  24.     #[GreaterThanOrEqual(0)]
  25.     private ?int $sucursalLimit null;
  26.     #[ORM\OneToMany(mappedBy'saasConfiguration'targetEntitySaasDocAllowed::class, cascade: ['persist'], orphanRemovaltrue)]
  27.     #[Valid(traversetrue)]
  28.     private Collection $docAlloweds;
  29.     public function __construct()
  30.     {
  31.         $this->docAlloweds = new ArrayCollection();
  32.     }
  33.     public function getId(): ?int
  34.     {
  35.         return $this->id;
  36.     }
  37.     public function getCompany(): ?SriInfo
  38.     {
  39.         return $this->company;
  40.     }
  41.     public function setCompany(SriInfo $company): self
  42.     {
  43.         $this->company $company;
  44.         return $this;
  45.     }
  46.     public function isShowTransporter(): ?bool
  47.     {
  48.         return $this->showTransporter;
  49.     }
  50.     public function setShowTransporter(?bool $showTransporter): self
  51.     {
  52.         $this->showTransporter $showTransporter;
  53.         return $this;
  54.     }
  55.     public function getSucursalLimit(): ?int
  56.     {
  57.         return $this->sucursalLimit;
  58.     }
  59.     public function setSucursalLimit(?int $sucursalLimit): self
  60.     {
  61.         $this->sucursalLimit $sucursalLimit;
  62.         return $this;
  63.     }
  64.     /**
  65.      * @return Collection<int, SaasDocAllowed>
  66.      */
  67.     public function getDocAlloweds(): Collection
  68.     {
  69.         return $this->docAlloweds;
  70.     }
  71.     public function addDocAllowed(SaasDocAllowed $docAllowed): self
  72.     {
  73.         if (!$this->docAlloweds->contains($docAllowed)) {
  74.             $this->docAlloweds->add($docAllowed);
  75.             $docAllowed->setSaasConfiguration($this);
  76.         }
  77.         return $this;
  78.     }
  79.     public function removeDocAllowed(SaasDocAllowed $docAllowed): self
  80.     {
  81.         if ($this->docAlloweds->removeElement($docAllowed)) {
  82.             // set the owning side to null (unless already changed)
  83.             if ($docAllowed->getSaasConfiguration() === $this) {
  84.                 $docAllowed->setSaasConfiguration(null);
  85.             }
  86.         }
  87.         return $this;
  88.     }
  89. }