src/Entity/Structure.php line 26

  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
  4. use ApiPlatform\Metadata\ApiFilter;
  5. use ApiPlatform\Metadata\ApiResource;
  6. use App\Repository\StructureRepository;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use Symfony\Component\Serializer\Annotation\Groups;
  11. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  12. #[ORM\Entity(repositoryClassStructureRepository::class)]
  13. #[ApiResource(
  14.     normalizationContext: [
  15.         'groups' => ['read']
  16.     ],
  17.     denormalizationContext: [
  18.         'groups' => ['write']
  19.     ],
  20.     mercuretrue,
  21. )]
  22. #[Vich\Uploadable]
  23. class Structure
  24. {
  25.     #[ORM\Id]
  26.     #[ORM\GeneratedValue]
  27.     #[ORM\Column]
  28.     #[Groups(['read'])]
  29.     private ?int $id null;
  30.     #[ORM\Column(length255nullabletrue)]
  31.     #[Groups(['read''write'])]
  32.     private ?string $denomSociale null;
  33.     #[ORM\Column(length255nullabletrue)]
  34.     #[Groups(['read''write'])]
  35.     private ?string $adresse null;
  36.     #[ORM\Column(length10nullabletrue)]
  37.     #[Groups(['read''write'])]
  38.     private ?string $codePostal null;
  39.     #[ORM\Column(length255nullabletrue)]
  40.     #[Groups(['read''write'])]
  41.     private ?string $ville null;
  42.     #[ORM\Column(length255nullabletrue)]
  43.     #[Groups(['read''write'])]
  44.     private ?string $siteWeb null;
  45.     #[ORM\Column(length255nullabletrue)]
  46.     #[Groups(['read''write'])]
  47.     private ?string $apiKey null;
  48.     #[ORM\Column(length255nullabletrue)]
  49.     #[Groups(['read''write'])]
  50.     private ?string $mail null;
  51.     #[ORM\Column(length255nullabletrue)]
  52.     #[Groups(['read''write'])]
  53.     private ?string $telephone null;
  54.     #[ORM\Column(length255nullabletrue)]
  55.     #[Groups(['read''write'])]
  56.     private ?string $ftpHost null;
  57.     #[ORM\Column(length255nullabletrue)]
  58.     #[Groups(['read''write'])]
  59.     private ?string $ftpUser null;
  60.     #[ORM\Column(length255nullabletrue)]
  61.     #[Groups(['read''write'])]
  62.     private ?string $ftpPass null;
  63.     #[ORM\Column(nullabletrue)]
  64.     #[Groups(['read''write'])]
  65.     private ?string $ftpPort null;
  66.     #[ORM\ManyToMany(targetEntityUser::class, mappedBy'structures')]
  67.     #[ApiFilter(SearchFilter::class, strategy'exact')]
  68.     #[Groups(['read'])]
  69.     private Collection $users;
  70.     #[ORM\ManyToOne(cascade: ['persist'])]
  71.     private ?MediaObject $logo null;
  72.     #[ORM\Column(length255nullabletrue)]
  73.     #[Groups(['read''write'])]
  74.     private ?string $smtpHost null;
  75.     #[ORM\Column(length255nullabletrue)]
  76.     #[Groups(['read''write'])]
  77.     private ?string $smtpPort null;
  78.     #[ORM\Column(length255nullabletrue)]
  79.     #[Groups(['read''write'])]
  80.     private ?string $smtpUser null;
  81.     #[ORM\Column(length255nullabletrue)]
  82.     #[Groups(['read''write'])]
  83.     private ?string $smtpPass null;
  84.     #[ORM\Column(length255nullabletrue)]
  85.     #[Groups(['read''write'])]
  86.     private ?string $smtpEncryption null;
  87.     #[ORM\Column(nullabletrue)]
  88.     #[Groups(['read''write'])]
  89.     private ?bool $multi null;
  90.     #[ORM\Column(length255nullabletrue)]
  91.     #[Groups(['read''write'])]
  92.     private ?string $urlGamsys null;
  93.     #[ORM\Column(nullabletrue)]
  94.     #[Groups(['read''write'])]
  95.     private ?string $gamsysId null;
  96.     #[ORM\Column(length255nullabletrue)]
  97.     #[Groups(['read''write'])]
  98.     private ?string $ftpFolder null;
  99.     #[ORM\Column(length255nullabletrue)]
  100.     #[Groups(['read''write'])]
  101.     private ?string $ftpType null;
  102.     public function __construct()
  103.     {
  104.         $this->users = new ArrayCollection();
  105.     }
  106.     public function getId(): ?int
  107.     {
  108.         return $this->id;
  109.     }
  110.     public function getDenomSociale(): ?string
  111.     {
  112.         return $this->denomSociale;
  113.     }
  114.     public function setDenomSociale(?string $denomSociale): static
  115.     {
  116.         $this->denomSociale $denomSociale;
  117.         return $this;
  118.     }
  119.     public function getAdresse(): ?string
  120.     {
  121.         return $this->adresse;
  122.     }
  123.     public function setAdresse(?string $adresse): static
  124.     {
  125.         $this->adresse $adresse;
  126.         return $this;
  127.     }
  128.     public function getCodePostal(): ?string
  129.     {
  130.         return $this->codePostal;
  131.     }
  132.     public function setCodePostal(?string $codePostal): static
  133.     {
  134.         $this->codePostal $codePostal;
  135.         return $this;
  136.     }
  137.     public function getVille(): ?string
  138.     {
  139.         return $this->ville;
  140.     }
  141.     public function setVille(?string $ville): static
  142.     {
  143.         $this->ville $ville;
  144.         return $this;
  145.     }
  146.     public function getSiteWeb(): ?string
  147.     {
  148.         return $this->siteWeb;
  149.     }
  150.     public function setSiteWeb(?string $siteWeb): static
  151.     {
  152.         $this->siteWeb $siteWeb;
  153.         return $this;
  154.     }
  155.     public function getApiKey(): ?string
  156.     {
  157.         return $this->apiKey;
  158.     }
  159.     public function setApiKey(?string $apiKey): static
  160.     {
  161.         $this->apiKey $apiKey;
  162.         return $this;
  163.     }
  164.     public function getMail(): ?string
  165.     {
  166.         return $this->mail;
  167.     }
  168.     public function setMail(?string $mail): static
  169.     {
  170.         $this->mail $mail;
  171.         return $this;
  172.     }
  173.     public function getTelephone(): ?string
  174.     {
  175.         return $this->telephone;
  176.     }
  177.     public function setTelephone(?string $telephone): static
  178.     {
  179.         $this->telephone $telephone;
  180.         return $this;
  181.     }
  182.     /**
  183.      * @return Collection<int, User>
  184.      */
  185.     public function getUsers(): Collection
  186.     {
  187.         return $this->users;
  188.     }
  189.     public function addUser(User $user): static
  190.     {
  191.         if (!$this->users->contains($user)) {
  192.             $this->users->add($user);
  193.             $user->addStructure($this);
  194.         }
  195.         return $this;
  196.     }
  197.     public function removeUser(User $user): static
  198.     {
  199.         if ($this->users->removeElement($user)) {
  200.             $user->removeStructure($this);
  201.         }
  202.         return $this;
  203.     }
  204.     public function getAbreviation (): string
  205.     {
  206.         $denom strtoupper($this->getDenomSociale());
  207.         $size str_word_count($denom);
  208.         $abr "";
  209.         if ($size 1) {
  210.             $words explode(' '$denom);
  211.             foreach ($words as $word) {
  212.                 $abr .= $word[0];
  213.             }
  214.         } else {
  215.             $abr substr($denom03);
  216.         }
  217.         return $abr;
  218.     }
  219.     public function getLogo(): ?MediaObject
  220.     {
  221.         return $this->logo;
  222.     }
  223.     public function setLogo(?MediaObject $logo): static
  224.     {
  225.         $this->logo $logo;
  226.         return $this;
  227.     }
  228.     #[Groups(['read'])]
  229.     public function getLogoPath(): string
  230.     {
  231.         if ($this->getLogo()) {
  232.             return $this->getLogo()->getFullPath();
  233.         }
  234.         return "";
  235.     }
  236.     public function getFtpHost(): ?string
  237.     {
  238.         return $this->ftpHost;
  239.     }
  240.     public function setFtpHost(?string $ftp_host): static
  241.     {
  242.         $this->ftpHost $ftp_host;
  243.         return $this;
  244.     }
  245.     public function getFtpUser(): ?string
  246.     {
  247.         return $this->ftpUser;
  248.     }
  249.     public function setFtpUser(?string $ftp_user): static
  250.     {
  251.         $this->ftpUser $ftp_user;
  252.         return $this;
  253.     }
  254.     public function getFtpPass(): ?string
  255.     {
  256.         return $this->ftpPass;
  257.     }
  258.     public function setFtpPass(?string $ftp_pass): static
  259.     {
  260.         $this->ftpPass $ftp_pass;
  261.         return $this;
  262.     }
  263.     public function getFtpPort(): ?string
  264.     {
  265.         return $this->ftpPort;
  266.     }
  267.     public function setFtpPort(?string $ftp_port): static
  268.     {
  269.         $this->ftpPort $ftp_port;
  270.         return $this;
  271.     }
  272.     public function getSmtpHost(): ?string
  273.     {
  274.         return $this->smtpHost;
  275.     }
  276.     public function setSmtpHost(?string $smtpHost): static
  277.     {
  278.         $this->smtpHost $smtpHost;
  279.         return $this;
  280.     }
  281.     public function getSmtpPort(): ?string
  282.     {
  283.         return $this->smtpPort;
  284.     }
  285.     public function setSmtpPort(?string $smtpPort): static
  286.     {
  287.         $this->smtpPort $smtpPort;
  288.         return $this;
  289.     }
  290.     public function getSmtpUser(): ?string
  291.     {
  292.         return $this->smtpUser;
  293.     }
  294.     public function setSmtpUser(?string $smtpUser): static
  295.     {
  296.         $this->smtpUser $smtpUser;
  297.         return $this;
  298.     }
  299.     public function getSmtpPass(): ?string
  300.     {
  301.         return $this->smtpPass;
  302.     }
  303.     public function setSmtpPass(?string $smtpPass): static
  304.     {
  305.         $this->smtpPass $smtpPass;
  306.         return $this;
  307.     }
  308.     public function getSmtpEncryption(): ?string
  309.     {
  310.         return $this->smtpEncryption;
  311.     }
  312.     public function setSmtpEncryption(?string $smtpEncryption): static
  313.     {
  314.         $this->smtpEncryption $smtpEncryption;
  315.         return $this;
  316.     }
  317.     public function isMulti(): ?bool
  318.     {
  319.         return $this->multi;
  320.     }
  321.     public function setMulti(?bool $multi): static
  322.     {
  323.         $this->multi $multi;
  324.         return $this;
  325.     }
  326.     public function getUrlGamsys(): ?string
  327.     {
  328.         return $this->urlGamsys;
  329.     }
  330.     public function setUrlGamsys(?string $urlGamsys): static
  331.     {
  332.         $this->urlGamsys $urlGamsys;
  333.         return $this;
  334.     }
  335.     public function getGamsysId(): ?string
  336.     {
  337.         return $this->gamsysId;
  338.     }
  339.     public function setGamsysId(?string $gamsysId): static
  340.     {
  341.         $this->gamsysId $gamsysId;
  342.         return $this;
  343.     }
  344.     public function getFtpFolder(): ?string
  345.     {
  346.         return $this->ftpFolder;
  347.     }
  348.     public function setFtpFolder(?string $ftpFolder): static
  349.     {
  350.         $this->ftpFolder $ftpFolder;
  351.         return $this;
  352.     }
  353.     public function getFtpType(): ?string
  354.     {
  355.         return $this->ftpType;
  356.     }
  357.     public function setFtpType(?string $ftpType): static
  358.     {
  359.         $this->ftpType $ftpType;
  360.         return $this;
  361.     }
  362. }