src/Entity/DnsitTranslateCriterion.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Mask\MarkingCodesMask;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6.  * DnsitTranslateCriterion
  7.  *
  8.  * @ORM\Table(name="dnsit_translate_criterion", indexes={@ORM\Index(name="translate_criterion_criterion_code_idx", columns={"criterion_code"}), @ORM\Index(name="translate_criterion_criterion_text_key_idx", columns={"criterion_text_key"})})
  9.  * @ORM\Entity(repositoryClass="App\Repository\DnsitTranslateCriterionRepository")
  10.  */
  11. class DnsitTranslateCriterion
  12. {
  13.     /**
  14.      * @var int|null
  15.      *
  16.      * @ORM\Column(name="criterion_code", type="bigint", nullable=true, unique=true)
  17.      */
  18.     private $criterionCode;
  19.     /**
  20.      * @var string|null
  21.      *
  22.      * @ORM\Column(name="criterion_text_key", type="string", length=255, nullable=true, unique=true)
  23.      */
  24.     private $criterionTextKey;
  25.     /**
  26.      * @var string|null
  27.      *
  28.      * @ORM\Column(name="criterion_tag_key", type="string", length=255, nullable=true, unique=true)
  29.      */
  30.     private $criterionTagKey;
  31.     /**
  32.      * @var string|null
  33.      *
  34.      * @ORM\Column(name="en_name", type="string", length=255, nullable=true)
  35.      */
  36.     private $enName;
  37.     /**
  38.      * @var string|null
  39.      *
  40.      * @ORM\Column(name="de_name", type="string", length=255, nullable=true)
  41.      */
  42.     private $deName;
  43.     /**
  44.      * @var string|null
  45.      *
  46.      * @ORM\Column(name="nl_name", type="string", length=255, nullable=true)
  47.      */
  48.     private $nlName;
  49.     /**
  50.      * @var string|null
  51.      *
  52.      * @ORM\Column(name="it_name", type="string", length=255, nullable=true)
  53.      */
  54.     private $itName;
  55.     /**
  56.      * @var string|null
  57.      *
  58.      * @ORM\Column(name="es_name", type="string", length=255, nullable=true)
  59.      */
  60.     private $esName;
  61.     /**
  62.      * @ORM\Column(type="string", length=255, nullable=true)
  63.      */
  64.     private $ptName;
  65.     /**
  66.      * @var int|null
  67.      *
  68.      * @ORM\Column(name="qualitative", type="integer", nullable=true)
  69.      */
  70.     private $qualitative;
  71.     /**
  72.      * @var int|null
  73.      *
  74.      * @ORM\Column(name="class", type="integer", nullable=true)
  75.      */
  76.     private $class;
  77.     /**
  78.      * @var int|null
  79.      *
  80.      * @ORM\Column(name="value_type", type="integer", nullable=true)
  81.      */
  82.     private $valueType;
  83.     /**
  84.      * @var int|null
  85.      *
  86.      * @ORM\Column(name="entity", type="bigint", nullable=true)
  87.      */
  88.     private $entity;
  89.     /**
  90.      * @var int|null
  91.      *
  92.      * @ORM\Column(name="marking", type="smallint", nullable=true)
  93.      */
  94.     private $marking;
  95.     /**
  96.      * @var string|null
  97.      *
  98.      * @ORM\Column(name="params", type="text", nullable=true)
  99.      */
  100.     private $params;
  101.     /**
  102.      * @var \DateTime|null
  103.      *
  104.      * @ORM\Column(name="created_at", type="datetime", nullable=true)
  105.      */
  106.     private $createdAt;
  107.     /**
  108.      * @var int|null
  109.      *
  110.      * @ORM\Column(name="created_by", type="bigint", nullable=true)
  111.      */
  112.     private $createdBy;
  113.     /**
  114.      * @var \DateTime|null
  115.      *
  116.      * @ORM\Column(name="updated_at", type="datetime", nullable=true)
  117.      */
  118.     private $updatedAt;
  119.     /**
  120.      * @var int|null
  121.      *
  122.      * @ORM\Column(name="updated_by", type="bigint", nullable=true)
  123.      */
  124.     private $updatedBy;
  125.     /**
  126.      * @var int
  127.      *
  128.      * @ORM\Column(name="id", type="bigint")
  129.      * @ORM\Id
  130.      * @ORM\GeneratedValue(strategy="IDENTITY")
  131.      */
  132.     private $id;
  133.     /**
  134.      * @var \App\Entity\DnsitCriterionCategory
  135.      *
  136.      * @ORM\ManyToOne(targetEntity="App\Entity\DnsitCriterionCategory", inversedBy="translateCriterions")
  137.      * @ORM\JoinColumns({
  138.      *   @ORM\JoinColumn(name="criterion_category_id", referencedColumnName="id")
  139.      * })
  140.      */
  141.     private $criterionCategory;
  142.     public function __toString(){
  143.         return $this->criterionCode '-' $this->enName;
  144.     }
  145.     public function getCriterionCode(): ?int
  146.     {
  147.         return $this->criterionCode;
  148.     }
  149.     public function setCriterionCode(?int $criterionCode): self
  150.     {
  151.         $this->criterionCode $criterionCode;
  152.         return $this;
  153.     }
  154.     public function getCriterionTextKey(): ?string
  155.     {
  156.         return $this->criterionTextKey;
  157.     }
  158.     public function setCriterionTextKey(?string $criterionTextKey): self
  159.     {
  160.         $this->criterionTextKey $criterionTextKey;
  161.         return $this;
  162.     }
  163.     public function getCriterionTagKey(): ?string
  164.     {
  165.         return $this->criterionTagKey;
  166.     }
  167.     public function setCriterionTagKey(?string $criterionTagKey): self
  168.     {
  169.         $this->criterionTagKey $criterionTagKey;
  170.         return $this;
  171.     }
  172.     public function getEnName(): ?string
  173.     {
  174.         return $this->enName;
  175.     }
  176.     public function setEnName(?string $enName): self
  177.     {
  178.         $this->enName $enName;
  179.         return $this;
  180.     }
  181.     public function getDeName(): ?string
  182.     {
  183.         return $this->deName;
  184.     }
  185.     public function setDeName(?string $deName): self
  186.     {
  187.         $this->deName $deName;
  188.         return $this;
  189.     }
  190.     public function getNlName(): ?string
  191.     {
  192.         return $this->nlName;
  193.     }
  194.     public function setNlName(?string $nlName): self
  195.     {
  196.         $this->nlName $nlName;
  197.         return $this;
  198.     }
  199.     public function getItName(): ?string
  200.     {
  201.         return $this->itName;
  202.     }
  203.     public function setItName(?string $itName): self
  204.     {
  205.         $this->itName $itName;
  206.         return $this;
  207.     }
  208.     public function getEsName(): ?string
  209.     {
  210.         return $this->esName;
  211.     }
  212.     public function setEsName(?string $esName): self
  213.     {
  214.         $this->esName $esName;
  215.         return $this;
  216.     }
  217.     public function getPtName(): ?string
  218.     {
  219.         return $this->ptName;
  220.     }
  221.     public function setPtName(?string $ptName): self
  222.     {
  223.         $this->ptName $ptName;
  224.         return $this;
  225.     }
  226.     public function getQualitative(): ?int
  227.     {
  228.         return $this->qualitative;
  229.     }
  230.     public function setQualitative(?int $qualitative): self
  231.     {
  232.         $this->qualitative $qualitative;
  233.         return $this;
  234.     }
  235.     public function getClass(): ?int
  236.     {
  237.         return $this->class;
  238.     }
  239.     public function setClass(?int $class): self
  240.     {
  241.         $this->class $class;
  242.         return $this;
  243.     }
  244.     public function getValueType(): ?int
  245.     {
  246.         return $this->valueType;
  247.     }
  248.     public function setValueType(?int $valueType): self
  249.     {
  250.         $this->valueType $valueType;
  251.         return $this;
  252.     }
  253.     public function getEntity(): ?int
  254.     {
  255.         return $this->entity;
  256.     }
  257.     public function setEntity(?int $entity): self
  258.     {
  259.         $this->entity $entity;
  260.         return $this;
  261.     }
  262.     public function getMarking(): ?int
  263.     {
  264.         return $this->marking;
  265.     }
  266.     public function setMarking(?int $marking): self
  267.     {
  268.         $this->marking $marking;
  269.         return $this;
  270.     }
  271.     public function getParams(): ?string
  272.     {
  273.         return $this->params;
  274.     }
  275.     public function setParams(?string $params): self
  276.     {
  277.         $this->params $params;
  278.         return $this;
  279.     }
  280.     public function getCreatedAt(): ?\DateTimeInterface
  281.     {
  282.         return $this->createdAt;
  283.     }
  284.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  285.     {
  286.         $this->createdAt $createdAt;
  287.         return $this;
  288.     }
  289.     public function getCreatedBy(): ?int
  290.     {
  291.         return $this->createdBy;
  292.     }
  293.     public function setCreatedBy(?int $createdBy): self
  294.     {
  295.         $this->createdBy $createdBy;
  296.         return $this;
  297.     }
  298.     public function getUpdatedAt(): ?\DateTimeInterface
  299.     {
  300.         return $this->updatedAt;
  301.     }
  302.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  303.     {
  304.         $this->updatedAt $updatedAt;
  305.         return $this;
  306.     }
  307.     public function getUpdatedBy(): ?int
  308.     {
  309.         return $this->updatedBy;
  310.     }
  311.     public function setUpdatedBy(?int $updatedBy): self
  312.     {
  313.         $this->updatedBy $updatedBy;
  314.         return $this;
  315.     }
  316.     public function getId(): ?int
  317.     {
  318.         return $this->id;
  319.     }
  320.     public function __construct() {
  321.         // Champ qualitatif mis à 0 par défaut
  322.         $this->setQualitative(0);
  323.     }
  324.     public function bindLeiData($xmlCriterion$language) {
  325.         $this->setCriterionCode((int) $xmlCriterion->CRITERE);
  326.         $this->setQualitative((int) $xmlCriterion->CRITERE_QUALITATIF);
  327.         $this->setValueType((int) $xmlCriterion->CRITERE_TYPEVAL);
  328.     
  329.         switch ($language) {
  330.             case "en":
  331.                 $this->setEnName((string) $xmlCriterion->CRITERE_NOM);
  332.                 break;
  333.     
  334.             case "de":
  335.                 $this->setDeName((string) $xmlCriterion->CRITERE_NOM);
  336.                 break;
  337.     
  338.             case "nl":
  339.                 $this->setNlName((string) $xmlCriterion->CRITERE_NOM);
  340.                 break;
  341.     
  342.             case "it":
  343.                 $this->setItName((string) $xmlCriterion->CRITERE_NOM);
  344.                 break;
  345.     
  346.             case "es":
  347.                 $this->setEsName((string) $xmlCriterion->CRITERE_NOM);
  348.                 break;
  349.             case "pt":
  350.                 $this->setPtName((string) $xmlCriterion->CRITERE_NOM);
  351.                 break;
  352.         }
  353.         $this->setMarking(MarkingCodesMask::LEI);
  354.     }
  355.     public function bindTourinsoftData($jsonCriterion$language$suffixe "") {
  356.         $this->setCriterionTextKey(strtoupper($jsonCriterion->SyndicFieldID));
  357.         // $this->setCriterionCode($jsonCriterion->CRITERE);
  358.         switch ($jsonCriterion->ViewType) {
  359.             case 5:
  360.             case 6:
  361.                 $this->setQualitative(-1);
  362.                 break;
  363.             case 7:
  364.             case 8:
  365.                 $this->setQualitative(1);
  366.                 break;
  367.             // Non car les flux Tourinsoft mettent plusieurs le même critère en doub;on avec un type texte
  368.             // default:
  369.             //    $this->setQualitative(0);
  370.         }
  371.     
  372.         $this->setValueType($jsonCriterion->ViewType);
  373.         $name $jsonCriterion->SyndicFieldName;
  374.         if ($suffixe != "")
  375.             $name .= " (" $suffixe ")";
  376.         switch ($language) {
  377.             case "en":
  378.                 $this->setEnName($name);
  379.                 break;
  380.     
  381.             case "de":
  382.                 $this->setDeName($name);
  383.                 break;
  384.     
  385.             case "nl":
  386.                 $this->setNlName($name);
  387.                 break;
  388.     
  389.             case "it":
  390.                 $this->setItName($name);
  391.                 break;
  392.     
  393.             case "es":
  394.                 $this->setEsName($name);
  395.                 break;
  396.             case "pt":
  397.                 $this->setPtName($name);
  398.                 break;
  399.         }
  400.         $this->setMarking(MarkingCodesMask::TOURINSOFT);
  401.     }
  402.     public function getCriterionCategory(): ?DnsitCriterionCategory
  403.     {
  404.         return $this->criterionCategory;
  405.     }
  406.     public function setCriterionCategory(?DnsitCriterionCategory $criterionCategory): self
  407.     {
  408.         $this->criterionCategory $criterionCategory;
  409.         return $this;
  410.     }
  411. }