<?php
namespace App\Entity;
use App\Mask\MarkingCodesMask;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @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"})})
* @ORM\Entity (repositoryClass="App\Repository\DnsitModalityRepository")
*/
class DnsitModality
{
/**
* @var int|null
*
* @ORM\Column(name="modality_code", type="float", nullable=true)
*/
private $modalityCode;
/**
* @var string|null
*
* @ORM\Column(name="modality_tag_key", type="string", length=255, nullable=true)
*/
private $modalityTagKey;
/**
* @var string|null
*
* @ORM\Column(name="modality_text_key", type="string", length=255, nullable=true, unique=true)
*/
private $modalityTextKey;
/**
* @ORM\Column(type="string", length=4000, name="text_keys", nullable=true)
*/
private $textKeys;
/**
* @var string|null
*
* @ORM\Column(name="name", type="string", length=255, nullable=true)
*/
private $name;
/**
* @var int|null
*
* @ORM\Column(name="dn_order", type="integer", nullable=true)
*/
private $order;
/**
* @var int|null
*
* @ORM\Column(name="entity", type="bigint", nullable=true)
*/
private $entity;
/**
* @var int|null
*
* @ORM\Column(name="marking", type="smallint", nullable=true)
*/
private $marking;
/**
* @var string|null
*
* @ORM\Column(name="params", type="text", nullable=true)
*/
private $params;
/**
* @var \DateTime|null
*
* @ORM\Column(name="created_at", type="datetime", nullable=true)
*/
private $createdAt;
/**
* @var int|null
*
* @ORM\Column(name="created_by", type="bigint", nullable=true)
*/
private $createdBy;
/**
* @var \DateTime|null
*
* @ORM\Column(name="updated_at", type="datetime", nullable=true)
*/
private $updatedAt;
/**
* @var int|null
*
* @ORM\Column(name="updated_by", type="bigint", nullable=true)
*/
private $updatedBy;
/**
* @var int
*
* @ORM\Column(name="id", type="bigint")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var \App\Entity\DnsitCriterion
*
* @ORM\ManyToOne(targetEntity="App\Entity\DnsitCriterion", inversedBy="modalities")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="criterion_id", referencedColumnName="id")
* })
*/
private $criterion;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\WebFilterItem", mappedBy="modalities")
*/
private $filterItems;
/**
* @var \App\Entity\DnsitTranslateModality
*
* @ORM\ManyToOne(targetEntity="App\Entity\DnsitTranslateModality")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="translate_id", referencedColumnName="id")
* })
*/
private $translate;
/**
* @var \Doctrine\Common\Collections\Collection
*
* @ORM\OneToMany(targetEntity="App\Entity\WebSort", mappedBy="modality", cascade={"persist","remove"})
*/
private $sorts;
public function __construct()
{
$this->sorts = new ArrayCollection();
$this->filterItems = new ArrayCollection();
}
public function getModalityCode() : ?float
{
return $this->modalityCode;
}
public function setModalityCode(?float $modalityCode) : self
{
$this->modalityCode = $modalityCode;
return $this;
}
public function getModalityTextKey() : ?string
{
return $this->modalityTextKey;
}
public function setModalityTextKey(?string $modalityTextKey) : self
{
$this->modalityTextKey = $modalityTextKey;
return $this;
}
public function getName() : ?string
{
return $this->name;
}
public function setName(?string $name) : self
{
$this->name = $name;
return $this;
}
public function getOrder() : ?int
{
return $this->order;
}
public function setOrder(?int $order) : self
{
$this->order = $order;
return $this;
}
public function getEntity() : ?int
{
return $this->entity;
}
public function setEntity(?int $entity) : self
{
$this->entity = $entity;
return $this;
}
public function getMarking() : ?int
{
return $this->marking;
}
public function setMarking(?int $marking) : self
{
$this->marking = $marking;
return $this;
}
public function getParams() : ?string
{
return $this->params;
}
public function setParams(?string $params) : self
{
$this->params = $params;
return $this;
}
public function getCreatedAt() : ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeInterface $createdAt) : self
{
$this->createdAt = $createdAt;
return $this;
}
public function getCreatedBy() : ?int
{
return $this->createdBy;
}
public function setCreatedBy(?int $createdBy) : self
{
$this->createdBy = $createdBy;
return $this;
}
public function getUpdatedAt() : ?\DateTimeInterface
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeInterface $updatedAt) : self
{
$this->updatedAt = $updatedAt;
return $this;
}
public function getUpdatedBy() : ?int
{
return $this->updatedBy;
}
public function setUpdatedBy(?int $updatedBy) : self
{
$this->updatedBy = $updatedBy;
return $this;
}
public function getId() : ?int
{
return $this->id;
}
public function getCriterion() : ?DnsitCriterion
{
return $this->criterion;
}
public function setCriterion(?DnsitCriterion $criterion) : self
{
$this->criterion = $criterion;
return $this;
}
public function getTranslate() : ?DnsitTranslateModality
{
return $this->translate;
}
public function setTranslate(?DnsitTranslateModality $translate) : self
{
$this->translate = $translate;
return $this;
}
public function __toString()
{
return $this->getName();
}
public function bindLeiData($xmlModality, $language)
{
$this->setModalityCode((int) $xmlModality->MODALITE);
$this->setName((string) $xmlModality->MODALITE_NOM);
$order = intval((int) $xmlModality->MODALITE_ORDER);
if ($order || $order == 0) {
$this->setOrder($order);
}
$this->setMarking(MarkingCodesMask::LEI);
}
public function bindTourinsoftData($jsonModality, $language)
{
// $this->setModalityCode($jsonModality->MODALITE);
$this->setModalityTextKey(strtoupper($jsonModality->SyndicItemID));
$this->setName($jsonModality->ItemValue);
$order = intval($jsonModality->ItemOrder);
if ($order || $order == 0) {
$this->setOrder($order);
}
$this->setMarking(MarkingCodesMask::TOURINSOFT);
}
/**
* @return Collection|WebSort[]
*/
public function getSorts() : Collection
{
return $this->sorts;
}
public function addSort(WebSort $sort) : self
{
if (!$this->sorts->contains($sort)) {
$this->sorts[] = $sort;
$sort->setModality($this);
}
return $this;
}
public function removeSort(WebSort $sort) : self
{
if ($this->sorts->contains($sort)) {
$this->sorts->removeElement($sort);
// set the owning side to null (unless already changed)
if ($sort->getModality() === $this) {
$sort->setModality(null);
}
}
return $this;
}
public function getModalityTagKey() : ?string
{
return $this->modalityTagKey;
}
public function setModalityTagKey(?string $modalityTagKey) : self
{
$this->modalityTagKey = $modalityTagKey;
return $this;
}
public function getTextKeys() : ?string
{
return $this->textKeys;
}
public function setTextKeys(?string $textKeys) : self
{
$this->textKeys = $textKeys;
return $this;
}
/**
* @return Collection|WebFilterItem[]
*/
public function getFilterItems() : Collection
{
return $this->filterItems;
}
public function addFilterItem(WebFilterItem $item) : self
{
if (!$this->filterItems->contains($item)) {
$this->filterItems[] = $item;
$item->addModality($this);
}
return $this;
}
public function removeFilterItem(WebFilterItem $item) : self
{
if ($this->filterItems->contains($item)) {
$this->filterItems->removeElement($item);
$item->removeModality($this);
}
return $this;
}
}