src/Entity/Setting.php line 20

Open in your IDE?
  1. <?php
  2.     namespace App\Entity;
  3.     use App\Repository\SettingRepository;
  4.     use App\Traits\DateTrait;
  5.     use Doctrine\Common\Collections\ArrayCollection;
  6.     use Doctrine\Common\Collections\Collection;
  7.     use Doctrine\ORM\Mapping as ORM;
  8.     use JMS\Serializer\Annotation as Serializer;
  9.     use JMS\Serializer\Annotation\Expose;
  10.     use JMS\Serializer\Annotation\Groups;
  11.     use JMS\Serializer\Annotation\SerializedName;
  12.     /**
  13.      * @ORM\Entity(repositoryClass=SettingRepository::class)
  14.      *
  15.      * @Serializer\ExclusionPolicy ("ALL")
  16.      */
  17.     class Setting
  18.     {
  19.         use DateTrait;
  20.         /**
  21.          * Identifiant de l'entité
  22.          *
  23.          * @ORM\Id
  24.          * @ORM\GeneratedValue
  25.          * @ORM\Column(type="integer")
  26.          *
  27.          * @Expose
  28.          * @Groups ({"setting"})
  29.          */
  30.         private ?int $id NULL;
  31.         /**
  32.          * Nom du paramètre
  33.          *
  34.          * @ORM\Column(type="string", length=255, unique=true)
  35.          *
  36.          * @Expose
  37.          * @Groups ({"setting"})
  38.          */
  39.         private ?string $name NULL;
  40.         /**
  41.          * Valeur du paramètre
  42.          *
  43.          * @ORM\Column(type="text", nullable=true)
  44.          *
  45.          * @Expose
  46.          * @Groups ({"setting"})
  47.          */
  48.         private ?string $value NULL;
  49.         /**
  50.          * Description du paramètre
  51.          *
  52.          * @ORM\Column(type="text")
  53.          *
  54.          * @Expose
  55.          * @Groups ({"setting"})
  56.          */
  57.         private ?string $description NULL;
  58.         /**
  59.          * Type de champ
  60.          *
  61.          * @ORM\Column(type="string", length=30)
  62.          */
  63.         private ?string $fieldType NULL;
  64.         /**
  65.          * Titre du paramètre
  66.          *
  67.          * @ORM\Column(type="string", length=128, nullable=true)
  68.          *
  69.          * @Expose
  70.          * @Groups ({"setting"})
  71.          */
  72.         private ?string $title NULL;
  73.         /**
  74.          * @ORM\OneToMany(targetEntity=Catalogue::class, mappedBy="settingCatalogue", cascade={"persist", "remove"}, orphanRemoval=true)
  75.          */
  76.         private $catalogues;
  77.         /**
  78.          * @ORM\OneToMany(targetEntity=QuotasProductOrder::class, mappedBy="setting", cascade={"persist", "remove"}, orphanRemoval=true)
  79.          */
  80.         private $quotasProductOrders;
  81.         public function __construct()
  82.         {
  83.             $this->catalogues = new ArrayCollection();
  84.             $this->quotasProductOrders = new ArrayCollection();
  85.         }
  86.         /**
  87.          * @Serializer\VirtualProperty()
  88.          * @SerializedName ("title_description")
  89.          * @Groups ({"setting"})
  90.          *
  91.          * @return array
  92.          */
  93.         public function getNameDescription()
  94.         {
  95.             return [$this->title$this->description];
  96.         }
  97.         public function getId(): ?int
  98.         {
  99.             return $this->id;
  100.         }
  101.         public function getName(): ?string
  102.         {
  103.             return $this->name;
  104.         }
  105.         public function setName(string $name): self
  106.         {
  107.             $this->name $name;
  108.             return $this;
  109.         }
  110.         public function getValue(): ?string
  111.         {
  112.             return $this->value;
  113.         }
  114.         public function setValue(?string $value): self
  115.         {
  116.             $this->value $value;
  117.             return $this;
  118.         }
  119.         public function getDescription(): ?string
  120.         {
  121.             return $this->description;
  122.         }
  123.         public function setDescription(string $description): self
  124.         {
  125.             $this->description $description;
  126.             return $this;
  127.         }
  128.         public function getFieldType(): ?string
  129.         {
  130.             return $this->fieldType;
  131.         }
  132.         public function setFieldType(string $fieldType): self
  133.         {
  134.             $this->fieldType $fieldType;
  135.             return $this;
  136.         }
  137.         public function getTitle(): ?string
  138.         {
  139.             return $this->title;
  140.         }
  141.         public function setTitle(?string $title): self
  142.         {
  143.             $this->title $title;
  144.             return $this;
  145.         }
  146.         /**
  147.          * @return Collection<int, Catalogue>
  148.          */
  149.         public function getCatalogues(): Collection
  150.         {
  151.             return $this->catalogues;
  152.         }
  153.         public function addCatalogue(Catalogue $catalogue): self
  154.         {
  155.             if (!$this->catalogues->contains($catalogue)) {
  156.                 $this->catalogues[] = $catalogue;
  157.                 $catalogue->setSettingCatalogue($this);
  158.             }
  159.             return $this;
  160.         }
  161.         public function removeCatalogue(Catalogue $catalogue): self
  162.         {
  163.             if ($this->catalogues->removeElement($catalogue)) {
  164.                 // set the owning side to null (unless already changed)
  165.                 if ($catalogue->getSettingCatalogue() === $this) {
  166.                     $catalogue->setSettingCatalogue(null);
  167.                 }
  168.             }
  169.             return $this;
  170.         }
  171.         /**
  172.          * @return Collection<int, QuotasProductOrder>
  173.          */
  174.         public function getQuotasProductOrders(): Collection
  175.         {
  176.             return $this->quotasProductOrders;
  177.         }
  178.         public function addQuotasProductOrder(QuotasProductOrder $quotasProductOrder): self
  179.         {
  180.             if (!$this->quotasProductOrders->contains($quotasProductOrder)) {
  181.                 $this->quotasProductOrders[] = $quotasProductOrder;
  182.                 $quotasProductOrder->setSetting($this);
  183.             }
  184.             return $this;
  185.         }
  186.         public function removeQuotasProductOrder(QuotasProductOrder $quotasProductOrder): self
  187.         {
  188.             if ($this->quotasProductOrders->removeElement($quotasProductOrder)) {
  189.                 // set the owning side to null (unless already changed)
  190.                 if ($quotasProductOrder->getSetting() === $this) {
  191.                     $quotasProductOrder->setSetting(null);
  192.                 }
  193.             }
  194.             return $this;
  195.         }
  196.     }