<?php
namespace App\Entity;
use App\Mask\MarkingCodesMask;
use App\Service\BridgeFrontUtils;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Jsor\Doctrine\PostGIS\Types\PostGISType;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
/**
* DnsitProduct
*
* @ORM\Table(name="dnsit_product",indexes={@ORM\Index(name="search_product_text_key_idx", columns={"product_text_key"})})
* @ORM\Entity(repositoryClass="App\Repository\DnsitProductRepository")
*/
class DnsitProduct
{
/**
* @var string|null
*
* @ORM\Column(name="product_text_key", type="string", length=255, nullable=true, unique=true)
*/
private $productTextKey;
/**
* @var string|null
*
* @ORM\Column(name="name", type="string", length=255, nullable=true)
*/
private $name;
/**
* @var string|null
*
* @ORM\Column(name="slug", type="string", length=255, nullable=true)
*/
private $slug;
/**
* @var int|null
*
* @ORM\Column(name="product_code", type="bigint", nullable=true, unique=true)
*/
private $productCode;
/**
* @var int|null
*
* @ORM\Column(name="product_type_code", type="bigint", nullable=true)
*/
private $productTypeCode;
/**
* @var string|null
*
* @ORM\Column(name="type_name", type="string", nullable=true)
*/
private $typeName;
/**
* @var string|null
*
* @ORM\Column(name="dn_reference", type="string", nullable=true)
*/
private $reference;
/**
* @var string|null
*
* @ORM\Column(name="comment", type="text", nullable=true)
*/
private $comment;
/**
* @var float|null
*
* @ORM\Column(name="latitude", type="float", nullable=true)
*/
private $latitude;
/**
* @var float|null
*
* @ORM\Column(name="longitude", type="float", nullable=true)
*/
private $longitude;
/**
* @var int|null
*
* @ORM\Column(name="georef_type", type="integer", nullable=true)
*/
private $georefType;
/**
* @var int|null
*
* @ORM\Column(name="georef", type="integer", nullable=true)
*/
private $georef;
/**
* @var float|null
*
* @ORM\Column(name="distance", type="float", nullable=true)
*/
private $distance;
/**
* @var float|null
*
* @ORM\Column(name="score", type="float", nullable=true)
*/
private $score;
/**
* @var string|null
*
* @ORM\Column(name="location_name", type="string", length=255, nullable=true)
*/
private $locationName;
/**
* @var string|null
*
* @ORM\Column(name="street_num", type="string", length=255, nullable=true)
*/
private $streetNumber;
/**
* @var string|null
*
* @ORM\Column(name="street_name", type="string", length=255, nullable=true)
*/
private $streetName;
/**
* @var string|null
*
* @ORM\Column(name="addition_address", type="string", length=255, nullable=true)
*/
private $additionAddress;
/**
* @var string|null
*
* @ORM\Column(name="special_distribution_address", type="string", length=500, nullable=true)
*/
private $specialDistributionAddress;
/**
* @var string|null
*
* @ORM\Column(name="address", type="string", length=1000, nullable=true)
*/
private $address;
/**
* @var string|null
*
* @ORM\Column(name="zip_code", type="string", length=255, nullable=true)
*/
private $zipCode;
/**
* @var string|null
*
* @ORM\Column(name="insee", type="string", length=255, nullable=true)
*/
private $insee;
/**
* @var string|null
*
* @ORM\Column(name="city", type="string", length=255, nullable=true)
*/
private $city;
/**
* @var string|null
*
* @ORM\Column(name="country", type="string", length=255, nullable=true)
*/
private $country;
/**
* @var string|null
*
* @ORM\Column(name="phone", type="string", length=255, nullable=true)
*/
private $phone;
/**
* @var string|null
*
* @ORM\Column(name="phone2", type="string", length=255, nullable=true)
*/
private $phone2;
/**
* @var string|null
*
* @ORM\Column(name="phone3", type="string", length=255, nullable=true)
*/
private $phone3;
/**
* @var string|null
*
* @ORM\Column(name="fax", type="string", length=255, nullable=true)
*/
private $fax;
/**
* @var string|null
*
* @ORM\Column(name="email", type="string", length=255, nullable=true)
*/
private $email;
/**
* @var string|null
*
* @ORM\Column(name="email2", type="string", length=255, nullable=true)
*/
private $email2;
/**
* @var string|null
*
* @ORM\Column(name="url", type="text", nullable=true)
*/
private $url;
/**
* @var string|null
*
* @ORM\Column(name="url2", type="text", nullable=true)
*/
private $url2;
/**
* @var int|null
*
* @ORM\Column(name="entity_manager", type="bigint", nullable=true)
*/
private $entityManager;
/**
* @var int|null
*
* @ORM\Column(name="provider_code", type="bigint", nullable=true)
*/
private $providerCode;
/**
* @var string|null
*
* @ORM\Column(name="provider_text_key", type="text", nullable=true)
*/
private $providerTextKey;
/**
* @var string|null
*
* @ORM\Column(name="provider_name", type="string", length=255, nullable=true)
*/
private $providerName;
/**
* @var string|null
*
* @ORM\Column(name="provider_civility", type="string", length=255, nullable=true)
*/
private $providerCivility;
/**
* @var string|null
*
* @ORM\Column(name="provider_responsible_name", type="string", length=255, nullable=true)
*/
private $providerResponsibleName;
/**
* @var string|null
*
* @ORM\Column(name="provider_responsible_firstname", type="string", length=255, nullable=true)
*/
private $providerResponsibleFirstname;
/**
* @var string|null
*
* @ORM\Column(name="provider_location_name", type="string", length=255, nullable=true)
*/
private $providerLocationName;
/**
* @var string|null
*
* @ORM\Column(name="provider_street_number", type="string", length=255, nullable=true)
*/
private $providerStreetNumber;
/**
* @var string|null
*
* @ORM\Column(name="provider_street_name", type="string", length=255, nullable=true)
*/
private $providerStreetName;
/**
* @var string|null
*
* @ORM\Column(name="provider_addition_address", type="string", length=255, nullable=true)
*/
private $providerAdditionAddress;
/**
* @var string|null
*
* @ORM\Column(name="provider_zip_code", type="string", length=255, nullable=true)
*/
private $providerZipCode;
/**
* @var string|null
*
* @ORM\Column(name="provider_city", type="string", length=255, nullable=true)
*/
private $providerCity;
/**
* @var string|null
*
* @ORM\Column(name="provider_country", type="string", length=255, nullable=true)
*/
private $providerCountry;
/**
* @var string|null
*
* @ORM\Column(name="provider_phone", type="string", length=255, nullable=true)
*/
private $providerPhone;
/**
* @var string|null
*
* @ORM\Column(name="provider_phone2", type="string", length=255, nullable=true)
*/
private $providerPhone2;
/**
* @var string|null
*
* @ORM\Column(name="provider_phone3", type="string", length=255, nullable=true)
*/
private $providerPhone3;
/**
* @var string|null
*
* @ORM\Column(name="provider_fax", type="string", length=255, nullable=true)
*/
private $providerFax;
/**
* @var string|null
*
* @ORM\Column(name="provider_email", type="string", length=255, nullable=true)
*/
private $providerEmail;
/**
* @var string|null
*
* @ORM\Column(name="provider_email2", type="string", length=255, nullable=true)
*/
private $providerEmail2;
/**
* @var string|null
*
* @ORM\Column(name="provider_url", type="string", length=255, nullable=true)
*/
private $providerUrl;
/**
* @var string|null
*
* @ORM\Column(name="provider_url2", type="string", length=255, nullable=true)
*/
private $providerUrl2;
/**
* @var string|null
*
* @ORM\Column(name="provider_special_distribution", type="string", length=255, nullable=true)
*/
private $providerSpecialDistribution;
/**
* @var string|null
*
* @ORM\Column(name="contact_civility", type="string", length=255, nullable=true)
*/
private $contactCivility;
/**
* @var string|null
*
* @ORM\Column(name="contact_lastname", type="string", length=255, nullable=true)
*/
private $contactLastname;
/**
* @var string|null
*
* @ORM\Column(name="contact_firstname", type="string", length=255, nullable=true)
*/
private $contactFirstName;
/**
* @var string|null
*
* @ORM\Column(name="manager_civility", type="string", length=255, nullable=true)
*/
private $managerCivility;
/**
* @var string|null
*
* @ORM\Column(name="manager_lastname", type="string", length=255, nullable=true)
*/
private $managerLastname;
/**
* @var string|null
*
* @ORM\Column(name="manager_firstname", type="string", length=255, nullable=true)
*/
private $managerFirstName;
/**
* @var string|null
*
* @ORM\Column(name="manager_street_number", type="string", length=255, nullable=true)
*/
private $managerStreetNumber;
/**
* @var string|null
*
* @ORM\Column(name="manager_street_name", type="string", length=255, nullable=true)
*/
private $managerStreetName;
/**
* @var string|null
*
* @ORM\Column(name="manager_addition_address", type="string", length=255, nullable=true)
*/
private $managerAdditionAddress;
/**
* @var string|null
*
* @ORM\Column(name="manager_zip_code", type="string", length=255, nullable=true)
*/
private $managerZipCode;
/**
* @var string|null
*
* @ORM\Column(name="manager_city", type="string", length=255, nullable=true)
*/
private $managerCity;
/**
* @var string|null
*
* @ORM\Column(name="manager_country", type="string", length=255, nullable=true)
*/
private $managerCountry;
/**
* @var string|null
*
* @ORM\Column(name="manager_phone", type="string", length=255, nullable=true)
*/
private $managerPhone;
/**
* @var string|null
*
* @ORM\Column(name="manager_phone2", type="string", length=255, nullable=true)
*/
private $managerPhone2;
/**
* @var string|null
*
* @ORM\Column(name="manager_phone3", type="string", length=255, nullable=true)
*/
private $managerPhone3;
/**
* @var string|null
*
* @ORM\Column(name="manager_fax", type="string", length=255, nullable=true)
*/
private $managerFax;
/**
* @var string|null
*
* @ORM\Column(name="manager_email", type="string", length=255, nullable=true)
*/
private $managerEmail;
/**
* @var string|null
*
* @ORM\Column(name="manager_email2", type="string", length=255, nullable=true)
*/
private $managerEmail2;
/**
* @var string|null
*
* @ORM\Column(name="manager_url", type="text", nullable=true)
*/
private $managerUrl;
/**
* @var string|null
*
* @ORM\Column(name="manager_url2", type="text", nullable=true)
*/
private $managerUrl2;
/**
* @var string|null
*
* @ORM\Column(name="manager_special_distribution", type="string", length=255, nullable=true)
*/
private $managerSpecialDistribution;
/**
* @var string|null
*
* @ORM\Column(name="internal_comment", type="text", nullable=true)
*/
private $internalComment;
/**
* @var string|null
*
* @ORM\Column(name="comment1", type="text", nullable=true)
*/
private $comment1;
/**
* @var string|null
*
* @ORM\Column(name="comment2", type="text", nullable=true)
*/
private $comment2;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $comment7;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $comment8;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $comment9;
/**
* @var string|null
*
* @ORM\Column(name="comment_html", type="text", nullable=true)
*/
private $commentHtml;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $commentHtml2;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $commentHtml3;
/**
* @var string|null
*
* @ORM\Column(name="memo1", type="text", nullable=true)
*/
private $memo1;
/**
* @var string|null
*
* @ORM\Column(name="memo2", type="text", nullable=true)
*/
private $memo2;
/**
* @var string|null
*
* @ORM\Column(name="memo3", type="text", nullable=true)
*/
private $memo3;
/**
* @var string|null
*
* @ORM\Column(name="documentationf", type="text", nullable=true)
*/
private $documentationf;
/**
* @var string|null
*
* @ORM\Column(name="documentationl1", type="text", nullable=true)
*/
private $documentationl1;
/**
* @var string|null
*
* @ORM\Column(name="documentationl2", type="text", nullable=true)
*/
private $documentationl2;
/**
* @var string|null
*
* @ORM\Column(name="kml", type="text", nullable=true)
*/
private $kml;
/**
*
* @ORM\Column(name="geo_point", type="geometry", options={"geometry_type":"POINT"}, nullable=true)
*/
private $geoPoint;
/**
*
* @ORM\Column(name="geo_linestring", type="geometry", options={"geometry_type":"LINESTRING"}, nullable=true)
*/
private $geoLinestring;
/**
* @var int|null
*
* @ORM\Column(name="entite", type="bigint", nullable=true)
*/
private $entite;
/**
* @var int|null
*
* @ORM\Column(name="marking", type="smallint", nullable=true)
*/
private $marking;
/**
* @var string|null
*
* @ORM\Column(name="params", type="json", nullable=true)
*/
private $params;
/**
* @var bool|null
*
* @ORM\Column(name="is_valid", type="boolean", nullable=true)
*/
private $isValid;
/**
* @var \DateTime|null
*
* @ORM\Column(name="valid_from", type="date", nullable=true)
*/
private $validFrom;
/**
* @var \DateTime|null
*
* @ORM\Column(name="valid_to", type="date", nullable=true)
*/
private $validTo;
/**
* @var \DateTime|null
*
* @ORM\Column(name="max_update", type="datetime", nullable=true)
*/
private $maxUpdate;
/**
* @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 $created_by;
/**
* @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|null
*
* @ORM\Column(name="alea", type="bigint", nullable=true)
*/
private $alea;
/**
* @var string|null
*
* @ORM\Column(name="document", type="text", nullable=true)
*/
private $document;
/**
* @var int
*
* @ORM\Column(name="id", type="bigint")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var \App\Entity\DnsitEntity
*
* @ORM\ManyToOne(targetEntity="App\Entity\DnsitEntity")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="entity_id", referencedColumnName="id")
* })
*/
private $productEntity;
/**
* @var \Doctrine\Common\Collections\Collection
*
* @ORM\OneToMany(targetEntity="App\Entity\DnsitProductCriterion", mappedBy="product", cascade={"persist","remove"})
*/
private $productCriterions;
/**
* @var \Doctrine\Common\Collections\Collection
*
* @ORM\OneToMany(targetEntity="App\Entity\CacheTemp", mappedBy="product", cascade={"persist"})
*/
private $cacheTemps;
/**
* @var \Doctrine\Common\Collections\Collection
*
* @ORM\OneToMany(targetEntity="App\Entity\DnsitHour", mappedBy="product", cascade={"persist"})
*/
private $hours;
/**
* @var \Doctrine\Common\Collections\Collection
*
* @ORM\OneToMany(targetEntity="App\Entity\DnsitShortHour", mappedBy="product", cascade={"persist"})
*/
private $shortHours;
/**
* @var \Doctrine\Common\Collections\Collection
*
* @ORM\OneToMany(targetEntity="App\Entity\DnsitCoupledProduct", mappedBy="product", cascade={"persist"})
*/
private $coupledProducts;
/**
* @var \Doctrine\Common\Collections\Collection
*
* @ORM\OneToMany(targetEntity="App\Entity\DnsitCoupledProduct", mappedBy="coupledProduct", cascade={"persist"})
*/
private $coupledCoupledProducts;
/**
* @var \App\Entity\DnsitType
*
* @ORM\ManyToOne(targetEntity="App\Entity\DnsitType")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="type_id", referencedColumnName="id")
* })
*/
private $type;
/**
* @var \App\Entity\CityInsee
*
* @ORM\ManyToOne(targetEntity="App\Entity\CityInsee")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="city_insee_id", referencedColumnName="id")
* })
*/
private $cityInsee;
/**
* @var \App\Entity\DnsitTranslateProduct
*
* @ORM\ManyToOne(targetEntity="App\Entity\DnsitTranslateProduct")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="translate_id", referencedColumnName="id", onDelete="SET NULL")
* })
*/
private $translate;
/**
* @var \Doctrine\Common\Collections\Collection
*
* @ORM\ManyToMany(targetEntity="App\Entity\DnsitProductCategory", inversedBy="products")
* @ORM\JoinTable(name="productCategory",
* joinColumns={
* @ORM\JoinColumn(name="product_id", referencedColumnName="id")
* },
* inverseJoinColumns={
* @ORM\JoinColumn(name="category_id", referencedColumnName="id")
* }
* )
*/
private $category;
/**
* @ORM\OneToMany(targetEntity="App\Entity\DnsitProductDispo", mappedBy="product", orphanRemoval=true)
*/
private $dispos;
/**
* @var \Doctrine\Common\Collections\Collection
* @ORM\OneToMany(targetEntity="App\Entity\WebFilterResult", mappedBy="product", orphanRemoval=true)
*/
private $webFilterResults;
private $parameters;
/**
* Constructor
*/
public function __construct()
{
$this->productCriterions = new \Doctrine\Common\Collections\ArrayCollection();
$this->cacheTemps = new \Doctrine\Common\Collections\ArrayCollection();
$this->hours = new \Doctrine\Common\Collections\ArrayCollection();
$this->shortHours = new \Doctrine\Common\Collections\ArrayCollection();
$this->coupledProducts = new \Doctrine\Common\Collections\ArrayCollection();
$this->coupledCoupledProducts = new \Doctrine\Common\Collections\ArrayCollection();
$this->category = new \Doctrine\Common\Collections\ArrayCollection();
$this->dispos = new ArrayCollection();
$this->webFilterResults = new ArrayCollection();
}
public static function getEntityForLan($language)
{
switch (strtolower($language)) {
case "en":
$repository = "DnsitEnProduct";
$productClass = "\App\Entity\DnsitEnProduct";
break;
case "de":
$repository = "DnsitDeProduct";
$productClass = "\App\Entity\DnsitDeProduct";
break;
case "nl":
$repository = "DnsitNlProduct";
$productClass = "\App\Entity\DnsitNlProduct";
break;
case "it":
$repository = "DnsitItProduct";
$productClass = "\App\Entity\DnsitItProduct";
break;
case "es":
$repository = "DnsitEsProduct";
$productClass = "\App\Entity\DnsitEsProduct";
break;
default :
$repository = "DnsitProduct";
$productClass = "\App\Entity\DnsitProduct";
break;
}
return $repository;
}
public function getProductTextKey(): ?string
{
return $this->productTextKey;
}
public function setProductTextKey(?string $productTextKey): self
{
$this->productTextKey = $productTextKey;
return $this;
}
public function getProductCode(): ?int
{
return $this->productCode;
}
public function setProductCode(?int $productCode): self
{
$this->productCode = $productCode;
return $this;
}
public function getProductTypeCode(): ?int
{
return $this->productTypeCode;
}
public function setProductTypeCode(?int $productTypeCode): self
{
$this->productTypeCode = $productTypeCode;
return $this;
}
public function getTypeName(): ?string
{
return $this->typeName;
}
public function setTypeName(?string $typeName): self
{
$this->typeName = $typeName;
return $this;
}
public function getReference(): ?string
{
return $this->reference;
}
public function setReference(?string $reference): self
{
$this->reference = $reference;
return $this;
}
public function getComment(): ?string
{
return $this->comment;
}
public function setComment(?string $comment): self
{
$this->comment = $comment;
return $this;
}
public function getGeorefType(): ?int
{
return $this->georefType;
}
public function setGeorefType(?int $georefType): self
{
$this->georefType = $georefType;
return $this;
}
public function getGeoref(): ?int
{
return $this->georef;
}
public function setGeoref(?int $georef): self
{
$this->georef = $georef;
return $this;
}
public function getDistance(): ?float
{
return $this->distance;
}
public function setDistance(?float $distance): self
{
$this->distance = $distance;
return $this;
}
public function getScore(): ?float
{
return $this->score;
}
public function setScore(?float $score): self
{
$this->score = $score;
return $this;
}
public function getLocationName(): ?string
{
return $this->locationName;
}
public function setLocationName(?string $locationName): self
{
// Patch DN 12/2020 : Touroinsoft ne controle pas la longueur de ses champs !!!
if (!empty($locationName) && strlen($locationName) > 255)
return $this;
$this->locationName = $locationName;
return $this;
}
public function getStreetNumber(): ?string
{
return $this->streetNumber;
}
public function setStreetNumber(?string $streetNumber): self
{
// Patch DN 12/2020 : Touroinsoft ne controle pas la longueur de ses champs !!!
if (!empty($streetNumber) && strlen($streetNumber) > 255)
return $this;
$this->streetNumber = $streetNumber;
return $this;
}
public function getStreetName(): ?string
{
return $this->streetName;
}
public function setStreetName(?string $streetName): self
{
// Patch DN 12/2020 : Touroinsoft ne controle pas la longueur de ses champs !!!
if (!empty($streetName) && strlen($streetName) > 255)
return $this;
$this->streetName = $streetName;
return $this;
}
public function getAdditionAddress(): ?string
{
return $this->additionAddress;
}
public function setAdditionAddress(?string $additionAddress): self
{
$this->additionAddress = $additionAddress;
return $this;
}
public function getSpecialDistributionAddress(): ?string
{
return $this->specialDistributionAddress;
}
public function setSpecialDistributionAddress(?string $specialDistributionAddress): self
{
$this->specialDistributionAddress = $specialDistributionAddress;
return $this;
}
public function getAddress(): ?string
{
return $this->address;
}
public function setAddress(?string $address): self
{
$this->address = $address;
return $this;
}
public function getZipCode(): ?string
{
return $this->zipCode;
}
public function setZipCode(?string $zipCode): self
{
// Patch DN 12/2020 : Touroinsoft ne controle pas la longueur de ses champs !!!
if (!empty($zipCode) && strlen($zipCode) > 255)
return $this;
$this->zipCode = $zipCode;
return $this;
}
public function getInsee(): ?string
{
return $this->insee;
}
public function setInsee(?string $insee): self
{
// Patch DN 12/2020 : Touroinsoft ne controle pas la longueur de ses champs !!!
if (!empty($insee) && strlen($insee) > 255)
return $this;
$this->insee = $insee;
return $this;
}
public function getCity(): ?string
{
return $this->city;
}
public function setCity(?string $city): self
{
// Patch DN 12/2020 : Touroinsoft ne controle pas la longueur de ses champs !!!
if (!empty($city) && strlen($city) > 255)
return $this;
$this->city = $city;
return $this;
}
public function getCountry(): ?string
{
return $this->country;
}
public function setCountry(?string $country): self
{
// Patch DN 12/2020 : Touroinsoft ne controle pas la longueur de ses champs !!!
if (!empty($country) && strlen($country) > 255)
return $this;
$this->country = $country;
return $this;
}
public function getPhone(): ?string
{
return $this->phone;
}
public function setPhone(?string $phone): self
{
// Patch DN 12/2020 : Touroinsoft ne controle pas la longueur de ses champs !!!
if (!empty($phone) && strlen($phone) > 255)
return $this;
$this->phone = $phone;
return $this;
}
public function getPhone2(): ?string
{
return $this->phone2;
}
public function setPhone2(?string $phone2): self
{
// Patch DN 12/2020 : Touroinsoft ne controle pas la longueur de ses champs !!!
if (!empty($phone2) && strlen($phone2) > 255)
return $this;
$this->phone2 = $phone2;
return $this;
}
public function getPhone3(): ?string
{
return $this->phone3;
}
public function setPhone3(?string $phone3): self
{
// Patch DN 12/2020 : Touroinsoft ne controle pas la longueur de ses champs !!!
if (!empty($phone3) && strlen($phone3) > 255)
return $this;
$this->phone3 = $phone3;
return $this;
}
public function getFax(): ?string
{
return $this->fax;
}
public function setFax(?string $fax): self
{
$this->fax = $fax;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): self
{
$this->email = $email;
return $this;
}
public function getEmail2(): ?string
{
return $this->email2;
}
public function setEmail2(?string $email2): self
{
$this->email2 = $email2;
return $this;
}
public function getUrl(): ?string
{
return $this->url;
}
public function setUrl(?string $url): self
{
$this->url = $url;
return $this;
}
public function getUrl2(): ?string
{
return $this->url2;
}
public function setUrl2(?string $url2): self
{
$this->url2 = $url2;
return $this;
}
public function getEntityManager(): ?int
{
return $this->entityManager;
}
public function setEntityManager(?int $entityManager): self
{
$this->entityManager = $entityManager;
return $this;
}
public function getProviderCode(): ?int
{
return $this->providerCode;
}
public function setProviderCode(?int $providerCode): self
{
$this->providerCode = $providerCode;
return $this;
}
public function getProviderName(): ?string
{
return $this->providerName;
}
public function setProviderName(?string $providerName): self
{
$this->providerName = $providerName;
return $this;
}
public function getProviderCivility(): ?string
{
return $this->providerCivility;
}
public function setProviderCivility(?string $providerCivility): self
{
// Patch DN 12/2020 : Touroinsoft ne controle pas la longueur de ses champs !!!
if (!empty($providerCivility) && strlen($providerCivility) > 255)
return $this;
$this->providerCivility = $providerCivility;
return $this;
}
public function getProviderResponsibleName(): ?string
{
return $this->providerResponsibleName;
}
public function setProviderResponsibleName(?string $providerResponsibleName): self
{
// Patch DN 12/2020 : Touroinsoft ne controle pas la longueur de ses champs !!!
if (!empty($providerResponsibleName) && strlen($providerResponsibleName) > 255)
return $this;
$this->providerResponsibleName = $providerResponsibleName;
return $this;
}
public function getProviderResponsibleFirstname(): ?string
{
return $this->providerResponsibleFirstname;
}
public function setProviderResponsibleFirstname(?string $providerResponsibleFirstname): self
{
// Patch DN 12/2020 : Touroinsoft ne controle pas la longueur de ses champs !!!
if (!empty($providerResponsibleFirstname) && strlen($providerResponsibleFirstname) > 255)
return $this;
$this->providerResponsibleFirstname = $providerResponsibleFirstname;
return $this;
}
public function getProviderLocationName(): ?string
{
return $this->providerLocationName;
}
public function setProviderLocationName(?string $providerLocationName): self
{
// Patch DN 12/2020 : Touroinsoft ne controle pas la longueur de ses champs !!!
if (!empty($providerLocationName) && strlen($providerLocationName) > 255)
return $this;
$this->providerLocationName = $providerLocationName;
return $this;
}
public function getProviderStreetNumber(): ?string
{
return $this->providerStreetNumber;
}
public function setProviderStreetNumber(?string $providerStreetNumber): self
{
// Patch DN 12/2020 : Touroinsoft ne controle pas la longueur de ses champs !!!
if (!empty($providerStreetNumber) && strlen($providerStreetNumber) > 255)
return $this;
$this->providerStreetNumber = $providerStreetNumber;
return $this;
}
public function getProviderStreetName(): ?string
{
return $this->providerStreetName;
}
public function setProviderStreetName(?string $providerStreetName): self
{
// Patch DN 12/2020 : Touroinsoft ne controle pas la longueur de ses champs !!!
if (!empty($providerStreetName) && strlen($providerStreetName) > 255)
return $this;
$this->providerStreetName = $providerStreetName;
return $this;
}
public function getProviderAdditionAddress(): ?string
{
return $this->providerAdditionAddress;
}
public function setProviderAdditionAddress(?string $providerAdditionAddress): self
{
$this->providerAdditionAddress = $providerAdditionAddress;
return $this;
}
public function getProviderZipCode(): ?string
{
return $this->providerZipCode;
}
public function setProviderZipCode(?string $providerZipCode): self
{
// Patch DN 12/2020 : Touroinsoft ne controle pas la longueur de ses champs !!!
if (!empty($providerZipCode) && strlen($providerZipCode) > 255)
return $this;
$this->providerZipCode = $providerZipCode;
return $this;
}
public function getProviderCity(): ?string
{
return $this->providerCity;
}
public function setProviderCity(?string $providerCity): self
{
// Patch DN 12/2020 : Touroinsoft ne controle pas la longueur de ses champs !!!
if (!empty($providerCity) && strlen($providerCity) > 255)
return $this;
$this->providerCity = $providerCity;
return $this;
}
public function getProviderCountry(): ?string
{
return $this->providerCountry;
}
public function setProviderCountry(?string $providerCountry): self
{
// Patch DN 12/2020 : Touroinsoft ne controle pas la longueur de ses champs !!!
if (!empty($providerCountry) && strlen($providerCountry) > 255)
return $this;
$this->providerCountry = $providerCountry;
return $this;
}
public function getProviderPhone(): ?string
{
return $this->providerPhone;
}
public function setProviderPhone(?string $providerPhone): self
{
// Patch DN 12/2020 : Touroinsoft ne controle pas la longueur de ses champs !!!
if (!empty($providerPhone) && strlen($providerPhone) > 255)
return $this;
$this->providerPhone = $providerPhone;
return $this;
}
public function getProviderPhone2(): ?string
{
return $this->providerPhone2;
}
public function setProviderPhone2(?string $providerPhone2): self
{
// Patch DN 12/2020 : Touroinsoft ne controle pas la longueur de ses champs !!!
if (!empty($providerPhone2) && strlen($providerPhone2) > 255)
return $this;
$this->providerPhone2 = $providerPhone2;
return $this;
}
public function getProviderPhone3(): ?string
{
return $this->providerPhone3;
}
public function setProviderPhone3(?string $providerPhone3): self
{
// Patch DN 12/2020 : Touroinsoft ne controle pas la longueur de ses champs !!!
if (!empty($providerPhone3) && strlen($providerPhone3) > 255)
return $this;
$this->providerPhone3 = $providerPhone3;
return $this;
}
public function getProviderFax(): ?string
{
return $this->providerFax;
}
public function setProviderFax(?string $providerFax): self
{
$this->providerFax = $providerFax;
return $this;
}
public function getProviderEmail(): ?string
{
return $this->providerEmail;
}
public function setProviderEmail(?string $providerEmail): self
{
$this->providerEmail = $providerEmail;
return $this;
}
public function getProviderEmail2(): ?string
{
return $this->providerEmail2;
}
public function setProviderEmail2(?string $providerEmail2): self
{
$this->providerEmail2 = $providerEmail2;
return $this;
}
public function getProviderUrl(): ?string
{
return $this->providerUrl;
}
public function setProviderUrl(?string $providerUrl): self
{
$this->providerUrl = $providerUrl;
return $this;
}
public function getProviderUrl2(): ?string
{
return $this->providerUrl2;
}
public function setProviderUrl2(?string $providerUrl2): self
{
$this->providerUrl2 = $providerUrl2;
return $this;
}
public function getProviderSpecialDistribution(): ?string
{
return $this->providerSpecialDistribution;
}
public function setProviderSpecialDistribution(?string $providerSpecialDistribution): self
{
$this->providerSpecialDistribution = $providerSpecialDistribution;
return $this;
}
public function getContactCivility(): ?string
{
return $this->contactCivility;
}
public function setContactCivility(?string $contactCivility): self
{
$this->contactCivility = $contactCivility;
return $this;
}
public function getContactLastname(): ?string
{
return $this->contactLastname;
}
public function setContactLastname(?string $contactLastname): self
{
$this->contactLastname = $contactLastname;
return $this;
}
public function getContactFirstName(): ?string
{
return $this->contactFirstName;
}
public function setContactFirstName(?string $contactFirstName): self
{
$this->contactFirstName = $contactFirstName;
return $this;
}
public function getManagerCivility(): ?string
{
return $this->managerCivility;
}
public function setManagerCivility(?string $managerCivility): self
{
$this->managerCivility = $managerCivility;
return $this;
}
public function getManagerLastname(): ?string
{
return $this->managerLastname;
}
public function setManagerLastname(?string $managerLastname): self
{
$this->managerLastname = $managerLastname;
return $this;
}
public function getManagerFirstName(): ?string
{
return $this->managerFirstName;
}
public function setManagerFirstName(?string $managerFirstName): self
{
$this->managerFirstName = $managerFirstName;
return $this;
}
public function getManagerStreetNumber(): ?string
{
return $this->managerStreetNumber;
}
public function setManagerStreetNumber(?string $managerStreetNumber): self
{
$this->managerStreetNumber = $managerStreetNumber;
return $this;
}
public function getManagerStreetName(): ?string
{
return $this->managerStreetName;
}
public function setManagerStreetName(?string $managerStreetName): self
{
$this->managerStreetName = $managerStreetName;
return $this;
}
public function getManagerAdditionAddress(): ?string
{
return $this->managerAdditionAddress;
}
public function setManagerAdditionAddress(?string $managerAdditionAddress): self
{
$this->managerAdditionAddress = $managerAdditionAddress;
return $this;
}
public function getManagerZipCode(): ?string
{
return $this->managerZipCode;
}
public function setManagerZipCode(?string $managerZipCode): self
{
$this->managerZipCode = $managerZipCode;
return $this;
}
public function getManagerCity(): ?string
{
return $this->managerCity;
}
public function setManagerCity(?string $managerCity): self
{
$this->managerCity = $managerCity;
return $this;
}
public function getManagerCountry(): ?string
{
return $this->managerCountry;
}
public function setManagerCountry(?string $managerCountry): self
{
$this->managerCountry = $managerCountry;
return $this;
}
public function getManagerPhone(): ?string
{
return $this->managerPhone;
}
public function setManagerPhone(?string $managerPhone): self
{
$this->managerPhone = $managerPhone;
return $this;
}
public function getManagerPhone2(): ?string
{
return $this->managerPhone2;
}
public function setManagerPhone2(?string $managerPhone2): self
{
$this->managerPhone2 = $managerPhone2;
return $this;
}
public function getManagerPhone3(): ?string
{
return $this->managerPhone3;
}
public function setManagerPhone3(?string $managerPhone3): self
{
$this->managerPhone3 = $managerPhone3;
return $this;
}
public function getManagerFax(): ?string
{
return $this->managerFax;
}
public function setManagerFax(?string $managerFax): self
{
$this->managerFax = $managerFax;
return $this;
}
public function getManagerEmail(): ?string
{
return $this->managerEmail;
}
public function setManagerEmail(?string $managerEmail): self
{
$this->managerEmail = $managerEmail;
return $this;
}
public function getManagerEmail2(): ?string
{
return $this->managerEmail2;
}
public function setManagerEmail2(?string $managerEmail2): self
{
$this->managerEmail2 = $managerEmail2;
return $this;
}
public function getManagerUrl(): ?string
{
return $this->managerUrl;
}
public function setManagerUrl(?string $managerUrl): self
{
$this->managerUrl = $managerUrl;
return $this;
}
public function getManagerUrl2(): ?string
{
return $this->managerUrl2;
}
public function setManagerUrl2(?string $managerUrl2): self
{
$this->managerUrl2 = $managerUrl2;
return $this;
}
public function getManagerSpecialDistribution(): ?string
{
return $this->managerSpecialDistribution;
}
public function setManagerSpecialDistribution(?string $managerSpecialDistribution): self
{
$this->managerSpecialDistribution = $managerSpecialDistribution;
return $this;
}
public function getComment1(): ?string
{
return $this->comment1;
}
public function setComment1(?string $comment1): self
{
$this->comment1 = $comment1;
return $this;
}
public function getComment2(): ?string
{
return $this->comment2;
}
public function setComment2(?string $comment2): self
{
$this->comment2 = $comment2;
return $this;
}
public function getComment7(): ?string
{
return $this->comment7;
}
public function setComment7(?string $comment7): self
{
$this->comment7 = $comment7;
return $this;
}
public function getComment8(): ?string
{
return $this->comment8;
}
public function setComment8(?string $comment8): self
{
$this->comment8 = $comment8;
return $this;
}
public function getComment9(): ?string
{
return $this->comment9;
}
public function setComment9(?string $comment9): self
{
$this->comment9 = $comment9;
return $this;
}
public function getCommentHtml(): ?string
{
return $this->commentHtml;
}
public function setCommentHtml(?string $commentHtml): self
{
$this->commentHtml = $commentHtml;
return $this;
}
public function getCommentHtml2(): ?string
{
return $this->commentHtml2;
}
public function setCommentHtml2(?string $commentHtml2): self
{
$this->commentHtml2 = $commentHtml2;
return $this;
}
public function getCommentHtml3(): ?string
{
return $this->commentHtml3;
}
public function setCommentHtml3(?string $commentHtml3): self
{
$this->commentHtml3 = $commentHtml3;
return $this;
}
public function getMemo1(): ?string
{
return $this->memo1;
}
public function setMemo1(?string $memo1): self
{
$this->memo1 = $memo1;
return $this;
}
public function getMemo2(): ?string
{
return $this->memo2;
}
public function setMemo2(?string $memo2): self
{
$this->memo2 = $memo2;
return $this;
}
public function getMemo3(): ?string
{
return $this->memo3;
}
public function setMemo3(?string $memo3): self
{
$this->memo3 = $memo3;
return $this;
}
public function getDocumentationf(): ?string
{
return $this->documentationf;
}
public function setDocumentationf(?string $documentationf): self
{
$this->documentationf = $documentationf;
return $this;
}
public function getDocumentationl1(): ?string
{
return $this->documentationl1;
}
public function setDocumentationl1(?string $documentationl1): self
{
$this->documentationl1 = $documentationl1;
return $this;
}
public function getDocumentationl2(): ?string
{
return $this->documentationl2;
}
public function setDocumentationl2(?string $documentationl2): self
{
$this->documentationl2 = $documentationl2;
return $this;
}
public function getKml(): ?string
{
return $this->kml;
}
public function setKml(?string $kml): self
{
$this->kml = $kml;
return $this;
}
public function getGeoPoint()
{
return $this->geoPoint;
}
public function setGeoPoint($geoPoint): self
{
$this->geoPoint = $geoPoint;
return $this;
}
public function getGeoLinestring()
{
return $this->geoLinestring;
}
public function setGeoLinestring($geoLinestring): self
{
$this->geoLinestring = $geoLinestring;
return $this;
}
public function getEntite(): ?int
{
return $this->entite;
}
public function setEntite(?int $entite): self
{
$this->entite = $entite;
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 getIsValid(): ?bool
{
return $this->isValid;
}
public function setIsValid(?bool $isValid): self
{
$this->isValid = $isValid;
return $this;
}
public function getValidFrom(): ?\DateTimeInterface
{
return $this->validFrom;
}
public function setValidFrom(?\DateTimeInterface $validFrom): self
{
$this->validFrom = $validFrom;
return $this;
}
public function getValidTo(): ?\DateTimeInterface
{
return $this->validTo;
}
public function setValidTo(?\DateTimeInterface $validTo): self
{
$this->validTo = $validTo;
return $this;
}
public function getMaxUpdate(): ?\DateTimeInterface
{
return $this->maxUpdate;
}
public function setMaxUpdate(?\DateTimeInterface $maxUpdate): self
{
$this->maxUpdate = $maxUpdate;
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->created_by;
}
public function setCreatedBy(?int $created_by): self
{
$this->created_by = $created_by;
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 getAlea(): ?int
{
return $this->alea;
}
public function setAlea(?int $alea): self
{
$this->alea = $alea;
return $this;
}
public function getDocument(): ?string
{
return $this->document;
}
public function setDocument(?string $document): self
{
$this->document = $document;
return $this;
}
public function getId(): ?int
{
return $this->id;
}
/**
* @return Collection|DnsitProductCriterion[]
*/
public function getProductCriterions(): Collection
{
return $this->productCriterions;
}
public function addProductCriterion(DnsitProductCriterion $productCriterion): self
{
if (!$this->productCriterions->contains($productCriterion)) {
$this->productCriterions[] = $productCriterion;
$productCriterion->setProduct($this);
}
return $this;
}
public function removeProductCriterion(DnsitProductCriterion $productCriterion): self
{
if ($this->productCriterions->contains($productCriterion)) {
$this->productCriterions->removeElement($productCriterion);
// set the owning side to null (unless already changed)
if ($productCriterion->getProduct() === $this) {
$productCriterion->setProduct(null);
}
}
return $this;
}
/**
* @return Collection|CacheTemp[]
*/
public function getCacheTemps(): Collection
{
return $this->cacheTemps;
}
public function addCacheTemp(CacheTemp $cacheTemp): self
{
if (!$this->cacheTemps->contains($cacheTemp)) {
$this->cacheTemps[] = $cacheTemp;
$cacheTemp->setProduct($this);
}
return $this;
}
public function removeCacheTemp(CacheTemp $cacheTemp): self
{
if ($this->cacheTemps->contains($cacheTemp)) {
$this->cacheTemps->removeElement($cacheTemp);
// set the owning side to null (unless already changed)
if ($cacheTemp->getProduct() === $this) {
$cacheTemp->setProduct(null);
}
}
return $this;
}
/**
* @return Collection|DnsitHour[]
*/
public function getHours(): Collection
{
return $this->hours;
}
public function addHour(DnsitHour $hour): self
{
if (!$this->hours->contains($hour)) {
$this->hours[] = $hour;
$hour->setProduct($this);
}
return $this;
}
public function removeHour(DnsitHour $hour): self
{
if ($this->hours->contains($hour)) {
$this->hours->removeElement($hour);
// set the owning side to null (unless already changed)
if ($hour->getProduct() === $this) {
$hour->setProduct(null);
}
}
return $this;
}
/**
* @return Collection|DnsitShortHour[]
*/
public function getShortHours(): Collection
{
return $this->shortHours;
}
public function addShortHour(DnsitShortHour $shortHour): self
{
if (!$this->shortHours->contains($shortHour)) {
$this->shortHours[] = $shortHour;
$shortHour->setProduct($this);
}
return $this;
}
public function removeShortHour(DnsitShortHour $shortHour): self
{
if ($this->shortHours->contains($shortHour)) {
$this->shortHours->removeElement($shortHour);
// set the owning side to null (unless already changed)
if ($shortHour->getProduct() === $this) {
$shortHour->setProduct(null);
}
}
return $this;
}
/**
* @return Collection|DnsitCoupledProduct[]
*/
public function getCoupledProducts(): Collection
{
return $this->coupledProducts;
}
public function addCoupledProduct(DnsitCoupledProduct $coupledProduct): self
{
if (!$this->coupledProducts->contains($coupledProduct)) {
$this->coupledProducts[] = $coupledProduct;
$coupledProduct->setProduct($this);
}
return $this;
}
public function removeCoupledProduct(DnsitCoupledProduct $coupledProduct): self
{
if ($this->coupledProducts->contains($coupledProduct)) {
$this->coupledProducts->removeElement($coupledProduct);
// set the owning side to null (unless already changed)
if ($coupledProduct->getProduct() === $this) {
$coupledProduct->setProduct(null);
}
}
return $this;
}
/**
* @return Collection|DnsitCoupledProduct[]
*/
public function getCoupledCoupledProducts(): Collection
{
return $this->coupledCoupledProducts;
}
public function addCoupledCoupledProduct(DnsitCoupledProduct $coupledCoupledProduct): self
{
if (!$this->coupledCoupledProducts->contains($coupledCoupledProduct)) {
$this->coupledCoupledProducts[] = $coupledCoupledProduct;
$coupledCoupledProduct->setCoupledProduct($this);
}
return $this;
}
public function removeCoupledCoupledProduct(DnsitCoupledProduct $coupledCoupledProduct): self
{
if ($this->coupledCoupledProducts->contains($coupledCoupledProduct)) {
$this->coupledCoupledProducts->removeElement($coupledCoupledProduct);
// set the owning side to null (unless already changed)
if ($coupledCoupledProduct->getCoupledProduct() === $this) {
$coupledCoupledProduct->setCoupledProduct(null);
}
}
return $this;
}
public function getType(): ?DnsitType
{
return $this->type;
}
public function setType(?DnsitType $type): self
{
$this->type = $type;
return $this;
}
public function getCityInsee(): ?CityInsee
{
return $this->cityInsee;
}
public function setCityInsee(?CityInsee $cityInsee): self
{
$this->cityInsee = $cityInsee;
return $this;
}
public function getProductEntity(): ?DnsitEntity
{
return $this->productEntity;
}
public function setProductEntity(?DnsitEntity $ent): self
{
$this->productEntity = $ent;
return $this;
}
public function getTranslate(): ?DnsitTranslateProduct
{
return $this->translate;
}
public function setTranslate(?DnsitTranslateProduct $translate): self
{
$this->translate = $translate;
return $this;
}
/**
* @return Collection|DnsitProductCategory[]
*/
public function getCategory(): Collection
{
return $this->category;
}
public function addCategory(DnsitProductCategory $category): self
{
if (!$this->category->contains($category)) {
$this->category[] = $category;
}
return $this;
}
public function removeCategory(DnsitProductCategory $category): self
{
if ($this->category->contains($category)) {
$this->category->removeElement($category);
}
return $this;
}
public function bindLeiDatas($fiche)
{
if ((integer)$fiche->PRODUIT) {
$this->setProductCode((integer)$fiche->PRODUIT);
}
$longitude = str_replace(",", ".", $fiche->LONGITUDE);
$latitude = str_replace(",", ".", $fiche->LATITUDE);
if (abs((float)$longitude) >= 0 && abs((float)$longitude) <= 180 && abs((float)$latitude) >= 0 && abs((float)$latitude) < 90) {
$this->setLongitude((double)$longitude);
$this->setLatitude((double)$latitude);
// Patch 08/08/19 : ajout du cast string
// Patch JM 03/02/2022 : les points sont en LON LAT et non pas LAT LON
// $point = new \LongitudeOne\Spatial\PHP\Types\Geometry\Point($this->getLongitude(), $this->getLatitude());
// $point->setSrid("4326");
// $this->setGeoPoint($point);
$this->setGeoPoint('SRID=4326;POINT(' . $this->getLongitude() . ' ' . $this->getLatitude() . ')');
}
$this->setName((string)$fiche->NOM);
$this->setAddress((string)$fiche->ADRESSE);
$this->setStreetNumber((string)$fiche->ADRPROD_NUM_VOIE);
$this->setStreetName((string)$fiche->ADRPROD_LIB_VOIE);
$this->setAdditionAddress((string)$fiche->ADRPROD_COMPL_ADRESSE);
$this->setSpecialDistributionAddress((string)$fiche->ADRPROD_DISTRI_SPE);
$this->setZipCode((string)$fiche->ADRPROD_CP);
$this->setInsee((string)$fiche->INSEE);
$this->setCity((string)$fiche->ADRPROD_LIBELLE_COMMUNE);
$this->setCountry((string)$fiche->ADRPROD_PAYS);
if ((integer)$fiche->GEOREF) {
$this->setGeoref((integer)$fiche->GEOREF);
}
if ((integer)$fiche->GEOREFTYPE) {
$this->setGeorefType((integer)$fiche->GEOREFTYPE);
}
$this->setEmail((string)$fiche->ADRPROD_EMAIL);
$this->setEmail2((string)$fiche->ADRPROD_EMAIL2);
$this->setPhone((string)$fiche->ADRPROD_TEL);
$this->setPhone2((string)$fiche->ADRPROD_TEL2);
$this->setPhone3((string)$fiche->ADRPROD_TEL3);
$this->setUrl((string)$fiche->ADRPROD_URL);
$this->setUrl2((string)$fiche->ADRPROD_URL2);
$this->setComment((string)$fiche->COMMENTAIRE);
$this->setComment1((string)$fiche->COMMENTAIREL1);
$this->setComment2((string)$fiche->COMMENTAIREL2);
$this->setComment7((string)$fiche->COMMENTAIRE7);
$this->setComment8((string)$fiche->COMMENTAIRE8);
$this->setComment9((string)$fiche->COMMENTAIRE9);
$this->setCommentHtml((string)$fiche->COMMENTAIREHTML);
$this->setCommentHtml2((string)$fiche->COMMENTAIREHTML2);
$this->setCommentHtml3((string)$fiche->COMMENTAIREHTML3);
$this->setInternalComment((string)$fiche->COMMENTAIREINTERNE);
$this->setMemo1((string)$fiche->MEMO1);
$this->setMemo2((string)$fiche->MEMO2);
$this->setMemo3((string)$fiche->MEMO3);
$this->setProviderCivility((string)$fiche->PREST_CIVILITE);
$this->setProviderResponsibleFirstname((string)$fiche->PREST_PRENOM_RESP);
$this->setProviderResponsibleName((string)$fiche->PREST_NOM_RESP);
$this->setProviderName((string)$fiche->PREST_NOM);
$this->setProviderStreetNumber((string)$fiche->ADRPREST_NUM_VOIE);
$this->setProviderStreetName((string)$fiche->ADRPREST_LIB_VOIE);
$this->setProviderAdditionAddress((string)$fiche->ADRPREST_COMPL_ADRESSE);
$this->setProviderZipCode((string)$fiche->ADRPREST_CP);
$this->setProviderCity((string)$fiche->ADRPREST_LIBELLE_COMMUNE);
$this->setProviderCountry((string)$fiche->ADRPREST_PAYS);
$this->setProviderPhone((string)$fiche->ADRPREST_TEL);
$this->setProviderPhone2((string)$fiche->ADRPREST_TEL2);
$this->setProviderPhone3((string)$fiche->ADRPREST_TEL3);
$this->setProviderEmail((string)$fiche->ADRPREST_EMAIL);
$this->setProviderEmail2((string)$fiche->ADRPREST_EMAIL2);
$this->setProviderUrl((string)$fiche->ADRPREST_URL);
$this->setProviderUrl2((string)$fiche->ADRPREST_URL2);
$this->setContactCivility((string)$fiche->CIVILITE_RESPONSABLE);
$this->setContactFirstName((string)$fiche->PRENOM_RESPONSABLE);
$this->setContactLastName((string)$fiche->NOM_RESPONSABLE);
$this->setManagerCivility((string)$fiche->CIVILITE_PERSONNE_EN_CHARGE);
$this->setManagerLastName((string)$fiche->NOM_PERSONNE_EN_CHARGE);
$this->setManagerFirstName((string)$fiche->PRENOM_PERSONNE_EN_CHARGE);
$this->setManagerStreetNumber((string)$fiche->ADRPEC_NUM_VOIE);
$this->setManagerStreetName((string)$fiche->ADRPEC_LIB_VOIE);
$this->setManagerAdditionAddress((string)$fiche->ADRPEC_COMPL_ADRESSE);
$this->setManagerSpecialDistribution((string)$fiche->ADRPEC_DISTRI_SPE);
$this->setManagerZipCode((string)$fiche->ADRPEC_CP);
$this->setManagerCity((string)$fiche->ADRPEC_LIBELLE_COMMUNE);
$this->setManagerCountry((string)$fiche->ADRPEC_PAYS);
$this->setManagerPhone((string)$fiche->ADRPEC_TEL);
$this->setManagerPhone2((string)$fiche->ADRPEC_TEL2);
$this->setManagerPhone3((string)$fiche->ADRPEC_TEL3);
$this->setManagerFax((string)$fiche->ADRPEC_FAX);
$this->setManagerEmail((string)$fiche->ADRPEC_EMAIL);
$this->setManagerEmail2((string)$fiche->ADRPEC_EMAIL2);
$this->setManagerUrl((string)$fiche->ADRPEC_URL);
$this->setManagerUrl2((string)$fiche->ADRPEC_URL2);
$this->setDocumentationf((string)$fiche->DOCUMENTATIONF);
$this->setDocumentationl1((string)$fiche->DOCUMENTATIONL1);
$this->setDocumentationl2((string)$fiche->DOCUMENTATIONL2);
$this->setTypeName((string)$fiche->TYPE_NOM);
if ((integer)$fiche->ENTITE_GESTIONNAIRE) {
$this->setEntityManager((integer)$fiche->ENTITE_GESTIONNAIRE);
}
if ((integer)$fiche->MARQUAGE) {
$this->setMarking((integer)$fiche->MARQUAGE);
}
if ((integer)$fiche->PRESTATAIRE) {
$this->setProviderCode((integer)$fiche->PRESTATAIRE);
}
if ((integer)$fiche->TYPE_DE_PRODUIT) {
$this->setProductTypeCode((integer)$fiche->TYPE_DE_PRODUIT);
}
$tmp = (string)$fiche->DATMAJ;
$tmp = date_create_from_format("d/m/Y H:i:s", $tmp);
if ($tmp !== false) {
$this->setUpdatedAt($tmp);
}
$tmp = (string)$fiche->DATECREATION;
$tmp = date_create_from_format("d/m/Y H:i:s", $tmp);
if ($tmp !== false)
$this->setCreatedAt($tmp);
$tmp = (string)$fiche->VALABLE_DEPUIS;
$tmp = date_create_from_format("d/m/Y H:i:s", $tmp);
if ($tmp !== false)
$this->setValidFrom($tmp);
$tmp = (string)$fiche->VALABLE_JUSQU_A;
$tmp = date_create_from_format("d/m/Y H:i:s", $tmp);
if ($tmp !== false)
$this->setValidTo($tmp);
$tmp = (string)$fiche->MAXMAJ;
$tmp = date_create_from_format("d/m/Y H:i:s", $tmp);
if ($tmp !== false)
$this->setMaxUpdate($tmp);
// $this->setUpdatedAt((string) $fiche->DATMAJ);
//$this->setCreatedAt((string) $fiche->DATECREATION);
//$this->setValidFrom((string) $fiche->VALABLE_DEPUIS);
// $this->setValidTo((string) $fiche->VALABLE_JUSQU_A);
// $this->setMaxUpdate((string) $fiche->MAXMAJ);
if ((integer)$fiche->LALEA)
$this->setAlea((integer)$fiche->LALEA);
// Ici on intègre le KML
// $mods = BridgeFrontUtils::filterProductModalities($fiche->modalities,900002);
$testKML = $fiche->xpath('CRITERES/Crit[@CLEF_CRITERE=900002]');
if (!empty($testKML) && is_array($testKML) && !empty((string)$testKML[0])) {
$this->setKml((string)$testKML[0]);
// on récupère le contenu de l'URL stockée dans $KML
$urlKml = $this->kml;
// on prévoit plusieurs essais de connexion au cas où
$nberr = 0;
$done = false;
$kmlData = false;
$ctx = stream_context_create(array('http'=>
array(
'timeout' => 5, // 5 secondes
)
));
while (!$done && $nberr < 3) {
try {
$kmlData = @file_get_contents($urlKml, false, $ctx);
if ($kmlData !== false)
$done = true;
else
$nberr++;
} catch (\Exception $e) {
$nberr++;
}
if (!$done)
sleep($nberr);
}
if ($kmlData !== false) {
// on charge le KML dans une géométrie
$lineStringKML = \geoPHP::load($kmlData, 'kml');
// on s'assure qu'il s'agisse d'un élément simple
$simpleLineStringKML = \geoPHP::geometryReduce($lineStringKML);
$lineStringArray = array();
if ($simpleLineStringKML !== false & is_object($simpleLineStringKML)) {
// On s'attend à avoir une LineString mais il ya des fois des anomalies, on vérifie donc le type
$dataType = get_class($simpleLineStringKML);
// Doctrine Spatial a besoin d'un tableau de points en 2D seulement et les KML peuvent être en 3D
// Il faut aussi des types \LongitudeOne\Spatial\PHP\Types\Geometry\Point et non des types geoPHP\Point
// on récupère donc un tableau des composants de la géométrie
$lineStringKMLPoints = $simpleLineStringKML->getComponents();
if (is_array($lineStringKMLPoints) && count($lineStringKMLPoints) > 0) {
// si la géométrie est bien une LineString...
if ($dataType == 'LineString') {
foreach ($lineStringKMLPoints as $geoPhpPoint) {
if (is_array($geoPhpPoint->coords) && count($geoPhpPoint->coords) >= 2) {
// on boucle sur ses points
// $creofPoint = new \LongitudeOne\Spatial\PHP\Types\Geometry\Point($geoPhpPoint->coords[0], $geoPhpPoint->coords[1]);
// $creofPoint->setSrid("4326");
// $lineStringArray[] = $creofPoint;
$lineStringArray[] = $geoPhpPoint->coords[0] . ' ' . $geoPhpPoint->coords[1] ;
}
}
} else {
// Si la géométrie n'est pas une lineString, on considère que c'est soit une multilinestring (99% des cas) soit une multigeometry, on doit alors faire une deuxième boucle sur les objets
foreach ($lineStringKMLPoints as $lineString) {
$lineStringPoints = $lineString->getComponents();
if (is_array($lineStringPoints) && count($lineStringPoints) > 0) {
foreach ($lineStringPoints as $geoPhpPoint) {
if (is_array($geoPhpPoint->coords) && count($geoPhpPoint->coords) >= 2) {
// $creofPoint = new \LongitudeOne\Spatial\PHP\Types\Geometry\Point($geoPhpPoint->coords[0], $geoPhpPoint->coords[1]);
// $creofPoint->setSrid("4326");
// $lineStringArray[] = $creofPoint;
$lineStringArray[] = $geoPhpPoint->coords[0] . ' ' . $geoPhpPoint->coords[1] ;
}
}
}
}
}
}
}
if (!empty($lineStringArray)) {
// avec ce tableau de points, on crée un LineString PHP
// $lineString = new \LongitudeOne\Spatial\PHP\Types\Geometry\LineString($lineStringArray, "4326");
$lineString = 'SRID=4326;LINESTRING(' . implode(',', $lineStringArray) . ')';
// on le passe dans geoLineString
$this->setGeoLineString($lineString);
}
} else {
$this->setKml(null);
}
}
$this->setMarking(MarkingCodesMask::LEI);
}
public function getLatitude(): ?float
{
return $this->latitude;
}
public function setLatitude(?float $latitude): self
{
$this->latitude = $latitude;
return $this;
}
public function getLongitude(): ?float
{
return $this->longitude;
}
public function setLongitude(?float $longitude): self
{
$this->longitude = $longitude;
return $this;
}
public function bindTourinsoftDatas($fiche, $inutile='')
{
$tableau_balises_latitude = array("GmapLatitude", "LAT","DetailGOOGLEMAPLATITUDE", "LATITUDE");
$tableau_balises_longitude = array("GmapLongitude", "LON","DetailGOOGLEMAPLONGITUDE", "LONGITUDE");
$tableau_balises_traces = array("Itinerairegooglemap", "DetailTRACEGPS", "DetailTRACEGPS");
// améliorer le code ainsi quand on en aura le courage
$tableau_balises_nom = array("DetailNomoffre", "DetailNOMOFFRE", "DetailNOMMANIFESTATION", "Nomoffre", "Nomdeloffre", "SyndicObjectName");
$tableau_balises_ville = array("DetailCommune", "DetailCOMMUNE", "Commune", "COMMUNE", "COMMUNEPRINCIPALE", "COMMUNEDEPART", "Ville", "COMMUNETOURISTIQUE");
if (property_exists($fiche, 'DetailCommune') && !is_object($fiche->DetailCommune))
$this->setCity((string)$fiche->DetailCommune);
elseif (property_exists($fiche, 'DetailCOMMUNE') && !is_object($fiche->DetailCOMMUNE))
$this->setCity((string)$fiche->DetailCOMMUNE);
elseif (property_exists($fiche, 'Commune') && !is_object($fiche->Commune))
$this->setCity((string)$fiche->Commune);
elseif (property_exists($fiche, 'commune') && !is_object($fiche->commune))
$this->setCity((string)$fiche->commune);
elseif (property_exists($fiche, 'COMMUNE') && !is_object($fiche->COMMUNE))
$this->setCity((string)$fiche->COMMUNE);
elseif (property_exists($fiche, 'COMMUNEPRINCIPALE') && !is_object($fiche->COMMUNEPRINCIPALE))
$this->setCity((string)$fiche->COMMUNEPRINCIPALE);
elseif (property_exists($fiche, 'Ville') && !is_object($fiche->Ville))
$this->setCity((string)$fiche->Ville);
elseif (property_exists($fiche, 'COMMUNEDEPART') && !is_object($fiche->COMMUNEDEPART))
$this->setCity((string)$fiche->COMMUNEDEPART);
// Andernos
elseif (property_exists($fiche, 'ADRESSEs') && is_array($fiche->ADRESSEs) && count($fiche->ADRESSEs) > 0 && is_object($fiche->ADRESSEs[0]) && isset($fiche->ADRESSEs[0]->Communetouristique) && is_object($fiche->ADRESSEs[0]->Communetouristique) && property_exists($fiche->ADRESSEs[0]->Communetouristique, 'ThesLibelle'))
$this->setCity((string)$fiche->ADRESSEs[0]->Communetouristique->ThesLibelle);
// http://wcf.tourinsoft.com/Syndication/cdt37/339e9b43-b094-4871-867a-18d8dbdb7b20/Objects('ACCCEN0370007P')?$format=json
$this->setProductTextKey($fiche->SyndicObjectID);
$this->setMarking(0);
$longitude = 91;
$latitude = 181;
foreach($tableau_balises_latitude as $balise) {
if (property_exists($fiche, $balise) && isset($fiche->$balise)) {
$latitude = str_replace(",", ".", $fiche->$balise);
}
}
foreach($tableau_balises_longitude as $balise) {
if (property_exists($fiche, $balise) && isset($fiche->$balise)) {
$longitude = str_replace(",", ".", $fiche->$balise);
}
}
if (abs((float)$longitude) >= 0 && abs((float)$longitude) <= 180 && abs((float)$latitude) >= 0 && abs((float)$latitude) < 90) {
$this->setLongitude((float)$longitude);
$this->setLatitude((float)$latitude);
// Patch 08/08/19 : ajout du cast string
// $point = new \LongitudeOne\Spatial\PHP\Types\Geometry\Point($this->getLongitude(), $this->getLatitude());
// $point->setSrid("4326");
// $this->setGeoPoint($point);
$this->setGeoPoint('SRID=4326;POINT(' . $this->getLongitude() . ' ' . $this->getLatitude() . ')');
}
// Nouveau 06.11.2023 : traces GPS
$dataTrace = null;
foreach($tableau_balises_traces as $balise) {
if(isset($fiche->$balise))
$data = json_decode($fiche->$balise);
if(isset($data)) break;
}
if (isset($data) && is_object($data) && isset($data->lignes) && is_array($data->lignes)) {
// On va recoller les lignes
$lignesCollees = array();
foreach($data->lignes as $ligne) {
if(!is_object($ligne) || !isset($ligne->path))
continue;
$lignesCollees = array_merge($lignesCollees, $ligne->path);
}
$tableauWKT = array();
if(!empty($lignesCollees)) {
foreach($lignesCollees as $point) {
if(!is_array($point) || count($point) < 2) {
// Il y a parfois des points vides !!!
continue;
}
$tableauWKT[] = $point[1] . ' ' . $point[0]; // Lng lat
}
}
if(!empty($tableauWKT)) {
$lineString = 'SRID=4326;LINESTRING(' . implode(',', $tableauWKT) . ')';
$this->setGeoLinestring($lineString) ;
} /* else {
$this->setKml(null);
} */
}
// Fin traces GPS
// Nom de la fiche
foreach($tableau_balises_nom as $prop) {
if (property_exists($fiche, $prop) && !is_object($fiche->$prop))
$this->setName((string)$fiche->$prop);
elseif (property_exists($fiche, $prop) && is_object($fiche->$prop) && isset($fiche->$prop->ThesLibelle))
$this->setName((string)$fiche->$prop->ThesLibelle);
}
// $this->setAddress((string) $fiche->ADRESSE);
// $this->setStreetNumber((string) $fiche->ADRPROD_NUM_VOIE);
if (property_exists($fiche, 'AdresseComplete') && isset($fiche->AdresseComplete) && $fiche->AdresseComplete != '') {
$tabadr = explode('|', (string)$fiche->AdresseComplete);
if (count($tabadr) >= 6) {
$this->setStreetName($tabadr[0]);
$this->setAdditionAddress($tabadr[1]);
$this->setZipCode($tabadr[4]);
$this->setCity($tabadr[5]);
}
}
if (property_exists($fiche, 'DetailAdresse1') && !is_object($fiche->DetailAdresse1))
$this->setStreetName((string)$fiche->DetailAdresse1);
elseif (property_exists($fiche, 'DetailADRESSE1') && !is_object($fiche->DetailADRESSE1))
$this->setStreetName((string)$fiche->DetailADRESSE1);
elseif (property_exists($fiche, 'Adresse1') && !is_object($fiche->Adresse1))
$this->setStreetName((string)$fiche->Adresse1);
elseif (property_exists($fiche, 'AD1') && !is_object($fiche->AD1))
$this->setStreetName((string)$fiche->AD1);
elseif (property_exists($fiche, 'ADRESSE1') && !is_object($fiche->ADRESSE1))
$this->setStreetName((string)$fiche->ADRESSE1);
if (property_exists($fiche, 'DetailAdresse2') && !is_object($fiche->DetailAdresse2))
$this->setAdditionAddress((string)$fiche->DetailAdresse2);
elseif (property_exists($fiche, 'DetailADRESSE2') && !is_object($fiche->DetailADRESSE2))
$this->setAdditionAddress((string)$fiche->DetailADRESSE2);
elseif (property_exists($fiche, 'Adresse2') && !is_object($fiche->Adresse2))
$this->setAdditionAddress((string)$fiche->Adresse2);
elseif (property_exists($fiche, 'AD2') && !is_object($fiche->AD2))
$this->setAdditionAddress((string)$fiche->AD2);
elseif (property_exists($fiche, 'ADRESSE2') && !is_object($fiche->ADRESSE2))
$this->setAdditionAddress((string)$fiche->ADRESSE2);
if (property_exists($fiche, 'DetailADRESSE3'))
$this->setSpecialDistributionAddress((string)$fiche->DetailADRESSE3);
if (property_exists($fiche, 'AD3'))
$this->setSpecialDistributionAddress((string)$fiche->AD3);
elseif (property_exists($fiche, 'ADRESSE3'))
$this->setSpecialDistributionAddress((string)$fiche->ADRESSE3);
if (property_exists($fiche, 'DetailCodePostal') && !is_object($fiche->DetailCodePostal))
$this->setZipCode((string)$fiche->DetailCodePostal);
elseif (property_exists($fiche, 'DetailCODEPOSTAL') && !is_object($fiche->DetailCODEPOSTAL))
$this->setZipCode((string)$fiche->DetailCODEPOSTAL);
elseif (property_exists($fiche, 'CodePostal') && !is_object($fiche->CodePostal))
$this->setZipCode((string)$fiche->CodePostal);
elseif (property_exists($fiche, 'CP') && !is_object($fiche->CP))
$this->setZipCode((string)$fiche->CP);
elseif (property_exists($fiche, 'CODEPOSTAL') && !is_object($fiche->CODEPOSTAL))
$this->setZipCode((string)$fiche->CODEPOSTAL);
// ND patch 15.02.24 : ajout du break pour traiter le tableau dans l'ordre et s'arrêter
foreach($tableau_balises_ville as $prop) {
if (property_exists($fiche, $prop) && !is_object($fiche->$prop)) {
$this->setCity((string)$fiche->$prop);
break;
} elseif (property_exists($fiche, $prop) && is_object($fiche->$prop) && isset($fiche->$prop->ThesLibelle)) {
$this->setCity((string)$fiche->$prop->ThesLibelle);
break;
}
}
if (property_exists($fiche, 'DetailEmail') && !is_object($fiche->DetailEmail))
$this->setEmail((string)$fiche->DetailEmail);
elseif (property_exists($fiche, 'Email') && !is_object($fiche->Email))
$this->setEmail((string)$fiche->Email);
elseif (property_exists($fiche, 'CommMail') && !is_object($fiche->CommMail))
$this->setEmail((string)$fiche->CommMail);
elseif (property_exists($fiche, 'CoordonneesEmail') && !is_object($fiche->CoordonneesEmail))
$this->setEmail((string)$fiche->CoordonneesEmail);
elseif (property_exists($fiche, 'MAIL') && !is_object($fiche->MAIL))
$this->setEmail((string)$fiche->MAIL);
if (property_exists($fiche, 'DetailTel') && !is_object($fiche->DetailTel))
$this->setPhone((string)$fiche->DetailTel);
elseif (property_exists($fiche, 'Tel') && !is_object($fiche->Tel))
$this->setPhone((string)$fiche->Tel);
elseif (property_exists($fiche, 'TEL') && !is_object($fiche->TEL))
$this->setPhone((string)$fiche->TEL);
elseif (property_exists($fiche, 'CommTel') && !is_object($fiche->CommTel))
$this->setPhone((string)$fiche->CommTel);
elseif (property_exists($fiche, 'CoordonneesTelfixe') && !is_object($fiche->CoordonneesTelfixe))
$this->setPhone((string)$fiche->CoordonneesTelfixe);
if (property_exists($fiche, 'DetailTelportable'))
$this->setPhone2((string)$fiche->DetailTelportable);
elseif (property_exists($fiche, 'TelPortable'))
$this->setPhone2((string)$fiche->TelPortable);
elseif (property_exists($fiche, 'CommMob'))
$this->setPhone2((string)$fiche->CommMob);
elseif (property_exists($fiche, 'CoordonneesTelmobile'))
$this->setPhone2((string)$fiche->CoordonneesTelmobile);
elseif (property_exists($fiche, 'TELMOB'))
$this->setPhone2((string)$fiche->TELMOB);
if (property_exists($fiche, 'Detailurl'))
$this->setUrl((string)$fiche->Detailurl);
elseif (property_exists($fiche, 'Url'))
$this->setUrl((string)$fiche->Url);
elseif (property_exists($fiche, 'CommWeb'))
$this->setUrl((string)$fiche->CommWeb);
elseif (property_exists($fiche, 'CoordonneesSiteweb'))
$this->setUrl((string)$fiche->CoordonneesSiteweb);
elseif (property_exists($fiche, 'URL'))
$this->setUrl((string)$fiche->URL);
if (property_exists($fiche, 'DetailDescriptifOT'))
$this->setComment((string)$fiche->DetailDescriptifOT);
elseif (property_exists($fiche, 'Descriptif'))
$this->setComment((string)$fiche->Descriptif);
elseif (property_exists($fiche, 'Description'))
$this->setComment((string)$fiche->Description);
elseif (property_exists($fiche, 'DESCRIPTIF'))
$this->setComment((string)$fiche->DESCRIPTIF);
if (property_exists($fiche, 'DescriptifSynthetique'))
$this->setComment2((string)$fiche->DescriptifSynthetique);
// On stocke les données brutes de la fiche dans commentaireInterne
// Comme il peut y avoir des mises à jour successives avec différents champs
// On merge les infos avec l'existant
$testemp = $this->getInternalComment();
if (isset($testemp) && $testemp != null && $testemp != '') {
$ficheorig = json_decode($testemp);
$this->setInternalComment(json_encode((object)array_merge((array)$ficheorig, (array)$fiche)));
} else {
$this->setInternalComment(json_encode($fiche)); // On stocke la donnée JSON en brut dans le commentaire
}
// DetailContact est trop long car il peut contenir plusieurs contacts
// if (isset($fiche->DetailContact))
// $this->setProviderResponsibleName((string) $fiche->DetailContact);
if (property_exists($fiche, 'DetailRaisonsociale'))
$this->setProviderName((string)$fiche->DetailRaisonsociale);
elseif (property_exists($fiche, 'Raisonsociale'))
$this->setProviderName((string)$fiche->Raisonsociale);
if (property_exists($fiche, 'DetailSiteweb'))
$this->setProviderUrl((string)$fiche->DetailSiteweb);
elseif (property_exists($fiche, 'Siteweb'))
$this->setProviderUrl((string)$fiche->Siteweb);
if (property_exists($fiche, 'ObjectTypeName'))
$this->setTypeName((string)$fiche->ObjectTypeName);
if (property_exists($fiche, 'Updated') && isset($fiche->Updated)) {
$tmp = substr($fiche->Updated, 0, 19);
$tmp = str_replace('T', ' ', $tmp);
$tmp = date_create_from_format("Y-m-d H:i:s", $tmp);
if ($tmp !== false)
$this->setUpdatedAt($tmp);
}
if (property_exists($fiche, 'DATEMAJDISPO') && isset($fiche->DATEMAJDISPO) && strlen($fiche->DATEMAJDISPO) == 10) {
$tmp = date_create_from_format("d/m/Y", $fiche->DATEMAJDISPO);
if ($tmp !== false)
$this->setMaxUpdate($tmp);
}
$this->setMarking(MarkingCodesMask::TOURINSOFT);
}
public function getInternalComment(): ?string
{
return $this->internalComment;
}
public function setInternalComment(?string $internalComment): self
{
$this->internalComment = $internalComment;
return $this;
}
public function bindApidaeDatas($fiche, $languages = array())
{
// http://wcf.tourinsoft.com/Syndication/cdt37/339e9b43-b094-4871-867a-18d8dbdb7b20/Objects('ACCCEN0370007P')?$format=json
$this->setProductTextKey($fiche['identifier']);
if (isset($fiche['nom']) && isset($fiche['nom']['libelleFr']))
$this->setName((string)$fiche['nom']['libelleFr']);
else
return false;
if (isset($fiche['id']))
$this->setProductCode($fiche['id']);
else
return false;
// Patch 10.07.2023 : on remet les champ à null pour prendre en compte les effacements côté apidae
$this->setPhone(null);
$this->setPhone2(null);
$this->setPhone3(null);
$this->setUrl(null);
$this->setEmail(null);
$this->setLocationName(null);
$this->setAddress(null);
$this->setStreetName(null);
$this->setAdditionAddress(null);
$this->setSpecialDistributionAddress(null);
$this->setZipCode(null);
$this->setCity(null);
$this->setInsee(null);
$this->setComment(null);
// Patch 10/06/2022 : il peut y avoir des doublons dans ce code et il semble inutile
// $this->setProductTextKey($fiche['identifier']);
if (isset($fiche['informations']) && isset($fiche['informations']['moyensCommunication'])) {
$nbPhone = 0;
foreach ($fiche['informations']['moyensCommunication'] as $moycomm) {
$typecomm = '';
if (isset($moycomm['type']) && isset($moycomm['type']['id']) && isset($moycomm['coordonnees']) && isset($moycomm['coordonnees']['fr']))
$typecomm = (string)$moycomm['type']['id'];
if ($typecomm != '') {
switch ($typecomm) {
case "201": // TEL
if($nbPhone == 0)
$this->setPhone($moycomm['coordonnees']['fr']);
elseif($nbPhone == 1)
$this->setPhone2($moycomm['coordonnees']['fr']);
elseif($nbPhone == 2)
$this->setPhone3($moycomm['coordonnees']['fr']);
$nbPhone++;
break;
case "204": // MAIL
$this->setEmail($moycomm['coordonnees']['fr']);
break;
case "205": // URL
$this->setUrl($moycomm['coordonnees']['fr']);
break;
default: // TEL
// TODO : intégrer les autres données en critère
// $this->setPhone($moycomm['coordonnees']['fr']);
break;
}
}
}
}
if (isset($fiche['presentation']) && isset($fiche['presentation']['descriptifCourt']) && isset($fiche['presentation']['descriptifCourt']['libelleFr'])) {
$this->setComment((string)$fiche['presentation']['descriptifCourt']['libelleFr']);
}
if (isset($fiche['localisation']) && isset($fiche['localisation']['adresse']) && isset($fiche['localisation']['adresse']['nomDuLieu'])) {
$this->setLocationName((string)$fiche['localisation']['adresse']['nomDuLieu']);
} else {
$this->setLocationName(null);
}
if (isset($fiche['localisation']) && isset($fiche['localisation']['adresse']) && isset($fiche['localisation']['adresse']['adresse1'])) {
$this->setAddress((string)$fiche['localisation']['adresse']['adresse1']);
$this->setStreetName((string)$fiche['localisation']['adresse']['adresse1']);
} else {
$this->setStreetName(null);
}
if (isset($fiche['localisation']) && isset($fiche['localisation']['adresse']) && isset($fiche['localisation']['adresse']['adresse2'])) {
$this->setAdditionAddress((string)$fiche['localisation']['adresse']['adresse2']);
} else {
$this->setAdditionAddress(null);
}
if (isset($fiche['localisation']) && isset($fiche['localisation']['adresse']) && isset($fiche['localisation']['adresse']['adresse3'])) {
$this->setSpecialDistributionAddress((string)$fiche['localisation']['adresse']['adresse3']);
} else {
$this->setSpecialDistributionAddress(null);
}
if (isset($fiche['localisation']) && isset($fiche['localisation']['adresse']) && isset($fiche['localisation']['adresse']['codePostal'])) {
$this->setZipCode((string)$fiche['localisation']['adresse']['codePostal']);
} else {
$this->setZipCode(null);
}
if (isset($fiche['localisation']) && isset($fiche['localisation']['adresse']) && isset($fiche['localisation']['adresse']['commune']) && isset($fiche['localisation']['adresse']['commune']['nom'])) {
$this->setCity((string)$fiche['localisation']['adresse']['commune']['nom']);
} else {
$this->setCity(null);
}
if (isset($fiche['localisation']) && isset($fiche['localisation']['adresse']) && isset($fiche['localisation']['adresse']['commune']) && isset($fiche['localisation']['adresse']['commune']['code'])) {
$this->setInsee((string)$fiche['localisation']['adresse']['commune']['code']);
}
if (isset($fiche['localisation']) && isset($fiche['localisation']['geolocalisation']) && isset($fiche['localisation']['geolocalisation']['geoJson']) && isset($fiche['localisation']['geolocalisation']['geoJson']['coordinates'])) {
// echo "\nLATLON IS DEFINED";
$longitude = ((double)$fiche['localisation']['geolocalisation']['geoJson']['coordinates'][0]);
$latitude = ((double)$fiche['localisation']['geolocalisation']['geoJson']['coordinates'][1]);
if (abs((float)$longitude) >= 0 && abs((float)$longitude) <= 180 && abs((float)$latitude) >= 0 && abs((float)$latitude) < 90) {
$this->setLongitude((double)$longitude);
$this->setLatitude((double)$latitude);
// Patch 08/08/19 : ajout du cast string
// Patch JM 03/02/2022 : les points sont en LON LAT et non pas LAT LON
// $point = new \LongitudeOne\Spatial\PHP\Types\Geometry\Point($this->getLongitude(), $this->getLatitude());
//$point->setSrid("4326");
// $this->setGeoPoint($point);
$this->setGeoPoint('SRID=4326;POINT(' . $this->getLongitude() . ' ' . $this->getLatitude() . ')');
}
}
$this->setMarking(MarkingCodesMask::APIDAE);
}
public function __toString()
{
return $this->getName();
}
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(?string $slug): self
{
$this->slug = $slug;
return $this;
}
public function getProviderTextKey(): ?string
{
return $this->providerTextKey;
}
public function setProviderTextKey(?string $key): self
{
$this->providerTextKey = $key;
return $this;
}
/**
* @return Collection|DnsitProductDispo[]
*/
public function getDispos(): Collection
{
return $this->dispos;
}
public function addDispo(DnsitProductDispo $dispo): self
{
if (!$this->dispos->contains($dispo)) {
$this->dispos[] = $dispo;
$dispo->setProduct($this);
}
return $this;
}
public function removeDispo(DnsitProductDispo $dispo): self
{
if ($this->dispos->contains($dispo)) {
$this->dispos->removeElement($dispo);
// set the owning side to null (unless already changed)
if ($dispo->getProduct() === $this) {
$dispo->setProduct(null);
}
}
return $this;
}
/**
* @return Collection|WebFilterResult[]
*/
public function getWebFilterResults(): Collection
{
return $this->webFilterResults;
}
public function addWebFilterResult(WebFilterResult $webFilterResult): self
{
if (!$this->webFilterResults->contains($webFilterResult)) {
$this->webFilterResults[] = $webFilterResult;
$webFilterResult->setProduct($this);
}
return $this;
}
public function removeWebFilterResult(WebFilterResult $webFilterResult): self
{
if ($this->webFilterResults->contains($webFilterResult)) {
$this->webFilterResults->removeElement($webFilterResult);
// set the owning side to null (unless already changed)
if ($webFilterResult->getProduct() === $this) {
$webFilterResult->setProduct(null);
}
}
return $this;
}
}