src/Entity/DnsitModality.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Mask\MarkingCodesMask;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Table (name="dnsit_modality", indexes={@ORM\Index (name="modality_modality_code_idx", columns={"modality_code"}), @ORM\Index(name="modality_criterion_id_idx", columns={"criterion_id"}), @ORM\Index(name="modality_modality_text_key_idx", columns={"modality_text_key"})})
  9.  * @ORM\Entity (repositoryClass="App\Repository\DnsitModalityRepository")
  10.  */
  11. class DnsitModality
  12. {
  13.     /**
  14.      * @var int|null
  15.      *
  16.      * @ORM\Column(name="modality_code", type="float", nullable=true)
  17.      */
  18.     private $modalityCode;
  19.     /**
  20.      * @var string|null
  21.      *
  22.      * @ORM\Column(name="modality_tag_key", type="string", length=255, nullable=true)
  23.      */
  24.     private $modalityTagKey;
  25.     /**
  26.      * @var string|null
  27.      *
  28.      * @ORM\Column(name="modality_text_key", type="string", length=255, nullable=true, unique=true)
  29.      */
  30.     private $modalityTextKey;
  31.     /**
  32.      * @ORM\Column(type="string",  length=4000, name="text_keys", nullable=true)
  33.      */
  34.     private $textKeys;
  35.     /**
  36.      * @var string|null
  37.      *
  38.      * @ORM\Column(name="name", type="string", length=255, nullable=true)
  39.      */
  40.     private $name;
  41.     /**
  42.      * @var int|null
  43.      *
  44.      * @ORM\Column(name="dn_order", type="integer", nullable=true)
  45.      */
  46.     private $order;
  47.     /**
  48.      * @var int|null
  49.      *
  50.      * @ORM\Column(name="entity", type="bigint", nullable=true)
  51.      */
  52.     private $entity;
  53.     /**
  54.      * @var int|null
  55.      *
  56.      * @ORM\Column(name="marking", type="smallint", nullable=true)
  57.      */
  58.     private $marking;
  59.     /**
  60.      * @var string|null
  61.      *
  62.      * @ORM\Column(name="params", type="text", nullable=true)
  63.      */
  64.     private $params;
  65.     /**
  66.      * @var \DateTime|null
  67.      *
  68.      * @ORM\Column(name="created_at", type="datetime", nullable=true)
  69.      */
  70.     private $createdAt;
  71.     /**
  72.      * @var int|null
  73.      *
  74.      * @ORM\Column(name="created_by", type="bigint", nullable=true)
  75.      */
  76.     private $createdBy;
  77.     /**
  78.      * @var \DateTime|null
  79.      *
  80.      * @ORM\Column(name="updated_at", type="datetime", nullable=true)
  81.      */
  82.     private $updatedAt;
  83.     /**
  84.      * @var int|null
  85.      *
  86.      * @ORM\Column(name="updated_by", type="bigint", nullable=true)
  87.      */
  88.     private $updatedBy;
  89.     /**
  90.      * @var int
  91.      *
  92.      * @ORM\Column(name="id", type="bigint")
  93.      * @ORM\Id
  94.      * @ORM\GeneratedValue(strategy="IDENTITY")
  95.      */
  96.     private $id;
  97.     /**
  98.      * @var \App\Entity\DnsitCriterion
  99.      *
  100.      * @ORM\ManyToOne(targetEntity="App\Entity\DnsitCriterion", inversedBy="modalities")
  101.      * @ORM\JoinColumns({
  102.      *   @ORM\JoinColumn(name="criterion_id", referencedColumnName="id")
  103.      * })
  104.      */
  105.     private $criterion;
  106.     /**
  107.      * @ORM\ManyToMany(targetEntity="App\Entity\WebFilterItem", mappedBy="modalities")
  108.      */
  109.     private $filterItems;
  110.     /**
  111.      * @var \App\Entity\DnsitTranslateModality
  112.      *
  113.      * @ORM\ManyToOne(targetEntity="App\Entity\DnsitTranslateModality")
  114.      * @ORM\JoinColumns({
  115.      *   @ORM\JoinColumn(name="translate_id", referencedColumnName="id")
  116.      * })
  117.      */
  118.     private $translate;
  119.     /**
  120.      * @var \Doctrine\Common\Collections\Collection
  121.      *
  122.      * @ORM\OneToMany(targetEntity="App\Entity\WebSort", mappedBy="modality", cascade={"persist","remove"})
  123.      */
  124.     private $sorts;
  125.     public function __construct()
  126.     {
  127.         $this->sorts = new ArrayCollection();
  128.         $this->filterItems = new ArrayCollection();
  129.     }
  130.     public function getModalityCode() : ?float
  131.     {
  132.         return $this->modalityCode;
  133.     }
  134.     public function setModalityCode(?float $modalityCode) : self
  135.     {
  136.         $this->modalityCode $modalityCode;
  137.         return $this;
  138.     }
  139.     public function getModalityTextKey() : ?string
  140.     {
  141.         return $this->modalityTextKey;
  142.     }
  143.     public function setModalityTextKey(?string $modalityTextKey) : self
  144.     {
  145.         $this->modalityTextKey $modalityTextKey;
  146.         return $this;
  147.     }
  148.     public function getName() : ?string
  149.     {
  150.         return $this->name;
  151.     }
  152.     public function setName(?string $name) : self
  153.     {
  154.         $this->name $name;
  155.         return $this;
  156.     }
  157.     public function getOrder() : ?int
  158.     {
  159.         return $this->order;
  160.     }
  161.     public function setOrder(?int $order) : self
  162.     {
  163.         $this->order $order;
  164.         return $this;
  165.     }
  166.     public function getEntity() : ?int
  167.     {
  168.         return $this->entity;
  169.     }
  170.     public function setEntity(?int $entity) : self
  171.     {
  172.         $this->entity $entity;
  173.         return $this;
  174.     }
  175.     public function getMarking() : ?int
  176.     {
  177.         return $this->marking;
  178.     }
  179.     public function setMarking(?int $marking) : self
  180.     {
  181.         $this->marking $marking;
  182.         return $this;
  183.     }
  184.     public function getParams() : ?string
  185.     {
  186.         return $this->params;
  187.     }
  188.     public function setParams(?string $params) : self
  189.     {
  190.         $this->params $params;
  191.         return $this;
  192.     }
  193.     public function getCreatedAt() : ?\DateTimeInterface
  194.     {
  195.         return $this->createdAt;
  196.     }
  197.     public function setCreatedAt(?\DateTimeInterface $createdAt) : self
  198.     {
  199.         $this->createdAt $createdAt;
  200.         return $this;
  201.     }
  202.     public function getCreatedBy() : ?int
  203.     {
  204.         return $this->createdBy;
  205.     }
  206.     public function setCreatedBy(?int $createdBy) : self
  207.     {
  208.         $this->createdBy $createdBy;
  209.         return $this;
  210.     }
  211.     public function getUpdatedAt() : ?\DateTimeInterface
  212.     {
  213.         return $this->updatedAt;
  214.     }
  215.     public function setUpdatedAt(?\DateTimeInterface $updatedAt) : self
  216.     {
  217.         $this->updatedAt $updatedAt;
  218.         return $this;
  219.     }
  220.     public function getUpdatedBy() : ?int
  221.     {
  222.         return $this->updatedBy;
  223.     }
  224.     public function setUpdatedBy(?int $updatedBy) : self
  225.     {
  226.         $this->updatedBy $updatedBy;
  227.         return $this;
  228.     }
  229.     public function getId() : ?int
  230.     {
  231.         return $this->id;
  232.     }
  233.     public function getCriterion() : ?DnsitCriterion
  234.     {
  235.         return $this->criterion;
  236.     }
  237.     public function setCriterion(?DnsitCriterion $criterion) : self
  238.     {
  239.         $this->criterion $criterion;
  240.         return $this;
  241.     }
  242.     public function getTranslate() : ?DnsitTranslateModality
  243.     {
  244.         return $this->translate;
  245.     }
  246.     public function setTranslate(?DnsitTranslateModality $translate) : self
  247.     {
  248.         $this->translate $translate;
  249.         return $this;
  250.     }
  251.     public function __toString()
  252.     {
  253.         return $this->getName();
  254.     }
  255.     public function bindLeiData($xmlModality$language)
  256.     {
  257.         $this->setModalityCode((int) $xmlModality->MODALITE);
  258.         $this->setName((string) $xmlModality->MODALITE_NOM);
  259.         $order intval((int) $xmlModality->MODALITE_ORDER);
  260.         if ($order || $order == 0) {
  261.             $this->setOrder($order);
  262.         }
  263.         $this->setMarking(MarkingCodesMask::LEI);
  264.     }
  265.     public function bindTourinsoftData($jsonModality$language)
  266.     {
  267.         // $this->setModalityCode($jsonModality->MODALITE);
  268.         $this->setModalityTextKey(strtoupper($jsonModality->SyndicItemID));
  269.         $this->setName($jsonModality->ItemValue);
  270.         $order intval($jsonModality->ItemOrder);
  271.         if ($order || $order == 0) {
  272.             $this->setOrder($order);
  273.         }
  274.         $this->setMarking(MarkingCodesMask::TOURINSOFT);
  275.     }
  276.     /**
  277.      * @return Collection|WebSort[]
  278.      */
  279.     public function getSorts() : Collection
  280.     {
  281.         return $this->sorts;
  282.     }
  283.     public function addSort(WebSort $sort) : self
  284.     {
  285.         if (!$this->sorts->contains($sort)) {
  286.             $this->sorts[] = $sort;
  287.             $sort->setModality($this);
  288.         }
  289.         return $this;
  290.     }
  291.     public function removeSort(WebSort $sort) : self
  292.     {
  293.         if ($this->sorts->contains($sort)) {
  294.             $this->sorts->removeElement($sort);
  295.             // set the owning side to null (unless already changed)
  296.             if ($sort->getModality() === $this) {
  297.                 $sort->setModality(null);
  298.             }
  299.         }
  300.         return $this;
  301.     }
  302.     public function getModalityTagKey() : ?string
  303.     {
  304.         return $this->modalityTagKey;
  305.     }
  306.     public function setModalityTagKey(?string $modalityTagKey) : self
  307.     {
  308.         $this->modalityTagKey $modalityTagKey;
  309.         return $this;
  310.     }
  311.     public function getTextKeys() : ?string
  312.     {
  313.         return $this->textKeys;
  314.     }
  315.     public function setTextKeys(?string $textKeys) : self
  316.     {
  317.         $this->textKeys $textKeys;
  318.         return $this;
  319.     }
  320.     /**
  321.      * @return Collection|WebFilterItem[]
  322.      */
  323.     public function getFilterItems() : Collection
  324.     {
  325.         return $this->filterItems;
  326.     }
  327.     public function addFilterItem(WebFilterItem $item) : self
  328.     {
  329.         if (!$this->filterItems->contains($item)) {
  330.             $this->filterItems[] = $item;
  331.             $item->addModality($this);
  332.         }
  333.         return $this;
  334.     }
  335.     public function removeFilterItem(WebFilterItem $item) : self
  336.     {
  337.         if ($this->filterItems->contains($item)) {
  338.             $this->filterItems->removeElement($item);
  339.             $item->removeModality($this);
  340.         }
  341.         return $this;
  342.     }
  343. }