src/Entity/License.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\LicenseRepository;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Uid\Uuid;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. #[ORM\Table]
  9. #[ORM\Index(name'idx_lic_uniqueNumber'columns: ['unique_number'])]
  10. #[ORM\Index(name'idx_lic_uniqueNumber_createdAt'columns: ['unique_number''created_at'])]
  11. #[ORM\Entity(repositoryClassLicenseRepository::class)]
  12. class License
  13. {
  14.     public function __construct(){
  15.         $this->uuid Uuid::v4();
  16.         $this->createdAt = new \DateTimeImmutable();
  17.         $this->updatedAt = new \DateTimeImmutable();
  18.         $this->valid true;
  19.         $this->validityPeriod 12;
  20.         $this->oneDayCert false;
  21.     }
  22.     #[ORM\Id]
  23.     #[ORM\GeneratedValue]
  24.     #[ORM\Column(type'integer'uniquetrue)]
  25.     private $id;
  26.     #[Groups(['show_fiscalization','show_license'])]
  27.     #[ORM\Column(type'uuid')]
  28.     private $uuid;
  29.     #[Groups(['show_fiscalization','show_license'])]
  30.     #[ORM\Column(type'datetime_immutable')]
  31.     private $createdAt;
  32.     #[Groups(['show_fiscalization','show_license'])]
  33.     #[ORM\Column(type'datetime_immutable')]
  34.     private $updatedAt;
  35.     #[ORM\ManyToOne(targetEntityClient::class, inversedBy'licenses')]
  36.     #[ORM\JoinColumn(nullablefalse)]
  37.     private $client;
  38.     #[Groups(['show_fiscalization','show_license'])]
  39.     #[ORM\Column(type'string'length10)]
  40.     private $nip;
  41.     #[Groups(['show_license'])]
  42.     #[ORM\OneToOne(targetEntityFiscalization::class, inversedBy'license'cascade: ['persist''remove'])]
  43.     private $fiscalization;
  44.     #[Groups(['show_fiscalization','show_license'])]
  45.     #[ORM\Column(type'boolean')]
  46.     private $valid;
  47.     #[Groups(['show_fiscalization','show_license'])]
  48.     #[ORM\Column(type'string'length255nullabletrue)]
  49.     private $gmina;
  50.     #[Groups(['show_fiscalization','show_license'])]
  51.     #[ORM\Column(type'string'length255nullabletrue)]
  52.     private $kod;
  53.     #[Groups(['show_fiscalization','show_license'])]
  54.     #[ORM\Column(type'string'length255nullabletrue)]
  55.     private $kraj;
  56.     #[Groups(['show_fiscalization','show_license'])]
  57.     #[ORM\Column(type'string'length255nullabletrue)]
  58.     private $krajKod;
  59.     #[Groups(['show_fiscalization','show_license'])]
  60.     #[ORM\Column(type'string'length255nullabletrue)]
  61.     private $miejscowosc;
  62.     #[Groups(['show_fiscalization','show_license'])]
  63.     #[ORM\Column(type'string'length255nullabletrue)]
  64.     private $numBudynku;
  65.     #[Groups(['show_fiscalization','show_license'])]
  66.     #[ORM\Column(type'string'length255nullabletrue)]
  67.     private $numLokalu;
  68.     #[Groups(['show_fiscalization','show_license'])]
  69.     #[ORM\Column(type'string'length255nullabletrue)]
  70.     private $poczta;
  71.     #[Groups(['show_fiscalization','show_license'])]
  72.     #[ORM\Column(type'string'length255nullabletrue)]
  73.     private $powiat;
  74.      #[Groups(['show_fiscalization','show_license'])]
  75.     #[ORM\Column(type'string'length255nullabletrue)]
  76.     private $wojewodztwo;
  77.     #[Groups(['show_fiscalization','show_license'])]
  78.     #[ORM\Column(type'string'length255nullabletrue)]
  79.     private $ulica;
  80.     #[Groups(['show_fiscalization','show_license'])]
  81.     #[ORM\Column(type'string'length255nullabletrue)]
  82.     private $name;
  83.     #[Groups(['show_fiscalization','show_license'])]
  84.     #[ORM\Column(type'string'length255nullabletrue)]
  85.     private $regon;
  86.     #[Groups(['show_fiscalization','show_license'])]
  87.     #[ORM\Column(type'string'length255nullabletrue)]
  88.     private $deviceId;
  89.      #[Groups(['show_fiscalization','show_license'])]
  90.     #[ORM\Column(type'string'length30nullabletrue)]
  91.     private $uniqueNumber;
  92.     #[ORM\ManyToOne(targetEntityDeviceActivationRequest::class, inversedBy'licenses')]
  93.     private $activationRequest;
  94.     #[ORM\ManyToOne(targetEntityApp::class, inversedBy'licenses')]
  95.     private $app;
  96.     #[Groups(['show_fiscalization','show_license'])]
  97.     #[ORM\ManyToOne(targetEntityLicenseType::class, inversedBy'licenses')]
  98.     private $licenseType;
  99.     #[Groups(['show_fiscalization','show_license'])]
  100.     #[ORM\Column(type'date'nullabletrue)]
  101.     private $validUntil;
  102.     #[Groups(['show_fiscalization','show_license'])]
  103.     #[ORM\Column(type'date'nullabletrue)]
  104.     private $validFrom;
  105.     #[Groups(['show_fiscalization','show_license'])]
  106.     #[ORM\Column(type'integer')]
  107.     private $validityPeriod;
  108.     #[Groups(['show_fiscalization','show_license'])]
  109.     #[ORM\ManyToOne(targetEntityUser::class, inversedBy'licenses')]
  110.     private $user;
  111.     #[ORM\Column(type'boolean')]
  112.     private $oneDayCert;
  113.     private $qrcode;
  114.     public function getId()
  115.     {
  116.         return $this->id;
  117.     }
  118.     public function setId($id)
  119.     {
  120.         $this->id = (string)$id;
  121.         return $this;
  122.     }
  123.     public function getCreatedAt(): ?\DateTimeImmutable
  124.     {
  125.         return $this->createdAt;
  126.     }
  127.     public function setCreatedAt(\DateTimeImmutable $createdAt): self
  128.     {
  129.         $this->createdAt $createdAt;
  130.         return $this;
  131.     }
  132.     public function getUpdatedAt(): ?\DateTimeImmutable
  133.     {
  134.         return $this->updatedAt;
  135.     }
  136.     public function setUpdatedAt(\DateTimeImmutable $updatedAt): self
  137.     {
  138.         $this->updatedAt $updatedAt;
  139.         return $this;
  140.     }
  141.     public function getClient(): ?Client
  142.     {
  143.         return $this->client;
  144.     }
  145.     public function setClient(?Client $client): self
  146.     {
  147.         $this->client $client;
  148.         return $this;
  149.     }
  150.     public function getNip(): ?string
  151.     {
  152.         return $this->nip;
  153.     }
  154.     public function setNip(string $nip): self
  155.     {
  156.         $this->nip $nip;
  157.         return $this;
  158.     }
  159.     public function getFiscalization(): ?Fiscalization
  160.     {
  161.         return $this->fiscalization;
  162.     }
  163.     public function setFiscalization(?Fiscalization $fiscalization): self
  164.     {
  165.         $this->fiscalization $fiscalization;
  166.         return $this;
  167.     }
  168.     public function getValid(): ?bool
  169.     {
  170.         return $this->valid;
  171.     }
  172.     public function setValid(bool $valid): self
  173.     {
  174.         $this->valid $valid;
  175.         return $this;
  176.     }
  177.     public function getGmina(): ?string
  178.     {
  179.         return $this->gmina;
  180.     }
  181.     public function setGmina(?string $gmina): self
  182.     {
  183.         $this->gmina $gmina;
  184.         return $this;
  185.     }
  186.     public function getKod(): ?string
  187.     {
  188.         return $this->kod;
  189.     }
  190.     public function setKod(?string $kod): self
  191.     {
  192.         $this->kod $kod;
  193.         return $this;
  194.     }
  195.     public function getKraj(): ?string
  196.     {
  197.         return $this->kraj;
  198.     }
  199.     public function setKraj(?string $kraj): self
  200.     {
  201.         $this->kraj $kraj;
  202.         return $this;
  203.     }
  204.     public function getKrajKod(): ?string
  205.     {
  206.         return $this->krajKod;
  207.     }
  208.     public function setKrajKod(?string $krajKod): self
  209.     {
  210.         $this->krajKod $krajKod;
  211.         return $this;
  212.     }
  213.     public function getMiejscowosc(): ?string
  214.     {
  215.         return $this->miejscowosc;
  216.     }
  217.     public function setMiejscowosc(?string $miejscowosc): self
  218.     {
  219.         $this->miejscowosc $miejscowosc;
  220.         return $this;
  221.     }
  222.     public function getNumBudynku(): ?string
  223.     {
  224.         return $this->numBudynku;
  225.     }
  226.     public function setNumBudynku(?string $numBudynku): self
  227.     {
  228.         $this->numBudynku $numBudynku;
  229.         return $this;
  230.     }
  231.     public function getNumLokalu(): ?string
  232.     {
  233.         return $this->numLokalu;
  234.     }
  235.     public function setNumLokalu(?string $numLokalu): self
  236.     {
  237.         $this->numLokalu $numLokalu;
  238.         return $this;
  239.     }
  240.     public function getPoczta(): ?string
  241.     {
  242.         return $this->poczta;
  243.     }
  244.     public function setPoczta(?string $poczta): self
  245.     {
  246.         $this->poczta $poczta;
  247.         return $this;
  248.     }
  249.     public function getPowiat(): ?string
  250.     {
  251.         return $this->powiat;
  252.     }
  253.     public function setPowiat(?string $powiat): self
  254.     {
  255.         $this->powiat $powiat;
  256.         return $this;
  257.     }
  258.     public function getUlica(): ?string
  259.     {
  260.         return $this->ulica;
  261.     }
  262.     public function setUlica(?string $ulica): self
  263.     {
  264.         $this->ulica $ulica;
  265.         return $this;
  266.     }
  267.     public function getName(): ?string
  268.     {
  269.         return $this->name;
  270.     }
  271.     public function setName(?string $name): self
  272.     {
  273.         $this->name $name;
  274.         return $this;
  275.     }
  276.     public function getRegon(): ?string
  277.     {
  278.         return $this->regon;
  279.     }
  280.     public function setRegon(?string $regon): self
  281.     {
  282.         $this->regon $regon;
  283.         return $this;
  284.     }
  285.     /**
  286.      * Get the value of wojewodztwo
  287.      */ 
  288.     public function getWojewodztwo()
  289.     {
  290.         return $this->wojewodztwo;
  291.     }
  292.     /**
  293.      * Set the value of wojewodztwo
  294.      *
  295.      * @return  self
  296.      */ 
  297.     public function setWojewodztwo($wojewodztwo)
  298.     {
  299.         $this->wojewodztwo $wojewodztwo;
  300.         return $this;
  301.     }
  302.     public function getDeviceId(): ?string
  303.     {
  304.         return $this->deviceId;
  305.     }
  306.     public function setDeviceId(?string $deviceId): self
  307.     {
  308.         $this->deviceId $deviceId;
  309.         return $this;
  310.     }
  311.     public function getActivationRequest(): ?DeviceActivationRequest
  312.     {
  313.         return $this->activationRequest;
  314.     }
  315.     public function setActivationRequest(?DeviceActivationRequest $activationRequest): self
  316.     {
  317.         $this->activationRequest $activationRequest;
  318.         return $this;
  319.     }
  320.     public function getUniqueNumber(): ?string
  321.     {
  322.         return $this->uniqueNumber;
  323.     }
  324.     public function setUniqueNumber(string $uniqueNumber): self
  325.     {
  326.         $this->uniqueNumber $uniqueNumber;
  327.         return $this;
  328.     }
  329.     public function isValid(): ?bool
  330.     {
  331.         return $this->valid;
  332.     }
  333.     public function getApp(): ?App
  334.     {
  335.         return $this->app;
  336.     }
  337.     public function setApp(?App $app): self
  338.     {
  339.         $this->app $app;
  340.         return $this;
  341.     }
  342.     public function getLicenseType(): ?LicenseType
  343.     {
  344.         return $this->licenseType;
  345.     }
  346.     public function setLicenseType(?LicenseType $licenseType): self
  347.     {
  348.         $this->licenseType $licenseType;
  349.         return $this;
  350.     }
  351.     public function getValidUntil(): ?\DateTimeInterface
  352.     {
  353.         return $this->validUntil;
  354.     }
  355.     public function setValidUntil(?\DateTimeInterface $validUntil): self
  356.     {
  357.         $this->validUntil $validUntil;
  358.         return $this;
  359.     }
  360.     public function getValidFrom(): ?\DateTimeInterface
  361.     {
  362.         return $this->validFrom;
  363.     }
  364.     public function setValidFrom(?\DateTimeInterface $validFrom): self
  365.     {
  366.         $this->validFrom $validFrom;
  367.         return $this;
  368.     }
  369.     public function getUuid(){
  370.         return $this->uuid;
  371.     }
  372.     public function setUuid($uuid){
  373.         $this->uuid $uuid;
  374.         return $this;
  375.     }
  376.     public function getValidityPeriod(): ?int
  377.     {
  378.         return $this->validityPeriod;
  379.     }
  380.     public function setValidityPeriod(int $validityPeriod): self
  381.     {
  382.         $this->validityPeriod $validityPeriod;
  383.         return $this;
  384.     }
  385.     public function getUser(): ?User
  386.     {
  387.         return $this->user;
  388.     }
  389.     public function setUser(?User $user): self
  390.     {
  391.         $this->user $user;
  392.         return $this;
  393.     }
  394.     public function isOneDayCert(): ?bool
  395.     {
  396.         return $this->oneDayCert;
  397.     }
  398.     public function setOneDayCert(bool $oneDayCert): self
  399.     {
  400.         $this->oneDayCert $oneDayCert;
  401.         return $this;
  402.     }
  403.     /**
  404.      * Get the value of qrcode
  405.      */
  406.     public function getQrcode()
  407.     {
  408.         return 'https://system.abspos.pl/api/qr-code/'.$this->uuid.'.png?size=300';
  409.     }
  410. }