<?php
namespace App\Entity;
use App\Repository\ProduitRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass=ProduitRepository::class)
*/
class Produit
{
public const EXPORT_VENTE_FIELDS = [
'produit' => 'Produit',
'stock' => 'Stock',
'vente' => 'Ventes'
];
public const EXPORT_IMEIS_DELETED_FIELDS = [
'imei' => 'IMEI',
'produit' => 'Produit',
'raison' => 'Raison',
];
public const EXPORT_STOCK_PER_SIEGE_FIELDS = [
'siege' => 'Produit',
'stock' => 'Stock'
];
public const EXPORT_VENTE_PER_SIEGE_FIELDS = [
'siege' => 'Produit',
'vente' => 'Vente'
];
public const LOGO_ALLOWED_MIMETYPES = [
'png' => 'image/png',
'jpg' => 'image/jpeg'
];
public const CORREPONDANCE_PRODUITS = [
'4895180798498' => 'TERMINAL INFINIX Hot 30i 128 8 In Store',
'4401240431384' => 'TERMINAL INFINIX HOT 40i 4/128GB In Store',
'4895180783593' => 'TERMINAL INFINIX Note 12 128 4 In Store',
'4895180781339' => 'TERMINAL INFINIX Note 12i 128 4 In Store',
'4895180760174' => 'TERMINAL INFINIX SMART 6 In Store',
'4895180797279' => 'TERMINAL INFINIX SMART 7 In Store',
'4894947010392' => 'TERMINAL INFINIX SMART 8 In Store',
'4895180797538' => 'TERMINAL ITEL A04 In Store',
'4895180796876' => 'TERMINAL ITEL P40 In Store',
'89497010538' => 'TERMINAL TECNO POP8 4/128GB IN STORE',
'4895180798153' => 'TERMINAL TECNO SPARK 10 C 4 128GB In Store',
'4894947011559' => 'TERMINAL TECNO SPARK 20 8 256GB IN STORE',
];
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $numero;
/**
* @ORM\Column(type="string", length=255)
*/
private $nom;
/**
* @ORM\Column(type="text", nullable=true)
* @
*/
private $description;
/**
* @ORM\OneToMany(targetEntity=Devis::class, mappedBy="produit", orphanRemoval=false)
*/
private $devis;
/**
* @ORM\Column(type="string", length=255)
*/
private $codeProduit;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $logo;
/**
* @ORM\Column(type="float")
* @Assert\GreaterThan(0.0, message="Le prix doit être superieur à 0")
*/
private $prixDeVente;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $etat;
/**
* @ORM\Column(type="string", length=255)
*/
private $codeBarre;
/**
* @ORM\OneToMany(targetEntity=ImageProduit::class, mappedBy="produit")
*/
private $imageProduits;
/**
* @ORM\OneToMany(targetEntity=Stock::class, mappedBy="produit")
*/
private $stocks;
/**
* @ORM\Column(type="string", length=255 , nullable=true)
*/
private $apn;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $rom;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $ram;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $imei;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $producer;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $model;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $realeaseYear;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $os;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $chipset;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $numberCpuCore;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $internalMemory;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $memoryCardType;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $gpuName;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $gpuClock;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $availableColors;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $width;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $height;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $thickness;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $weight;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $usbConnectorType;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $usbVersion;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $builtInWifi;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $wifiVersion;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $wifiFeatures;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $builtInBluetooth;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $bluetoothFeatures;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $bluetoothVersion;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $builtInNfc;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $builtInGps;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $displayType;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $displayDiagonal;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $displayResolution;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $displayScreenToBodyRatio;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $displayPixelDensity;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $displayColors;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $otherDisplayFeatures;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $mainCameraResolution;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $mainCameraFeatures;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $selfieCameraResolution;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $batteryCapacity;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $batteryType;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $removaleBattery;
/**
* @ORM\OneToMany(targetEntity=ProduitIMEI::class, mappedBy="produit")
*/
private $produitIMEIs;
/**
* @ORM\OneToMany(targetEntity=FactureProduit::class, mappedBy="produit")
*/
private $factureProduits;
/**
* @ORM\OneToMany(targetEntity=BLProduit::class, mappedBy="produit")
*/
private $bLProduits;
/**
* @ORM\OneToMany(targetEntity=ProduitTransferer::class, mappedBy="produit")
*/
private $produitTransferers;
/**
* @ORM\Column(type="float", nullable=true)
*/
private $royalties;
private $totalStock = 0;
private $totalVente = 0;
/**
* @ORM\OneToMany(targetEntity=Changeroyalties::class, mappedBy="produit")
*/
private $changeroyalties;
/**
* @ORM\ManyToOne(targetEntity=DetailCommande::class, inversedBy="produit")
*/
private $detailCommande;
/**
* @ORM\OneToMany(targetEntity=DetailCommande::class, mappedBy="produit")
*/
private $detailCommandes;
public function __construct()
{
$this->devis = new ArrayCollection();
$this->imageProduits = new ArrayCollection();
$this->stocks = new ArrayCollection();
$this->produitIMEIs = new ArrayCollection();
$this->factureProduits = new ArrayCollection();
$this->bLProduits = new ArrayCollection();
$this->produitTransferers = new ArrayCollection();
$this->changeroyalties = new ArrayCollection();
$this->detailCommandes = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getNumero(): ?string
{
return $this->numero;
}
public function setNumero(string $numero): self
{
$this->numero = $numero;
return $this;
}
public function getNom(): ?string
{
return $this->nom;
}
public function setNom(string $nom): self
{
$this->nom = $nom;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(string $description): self
{
$this->description = $description;
return $this;
}
/**
* @return Collection<int, Devis>
*/
public function getDevis(): Collection
{
return $this->devis;
}
public function addDevi(Devis $devi): self
{
if (!$this->devis->contains($devi)) {
$this->devis[] = $devi;
$devi->setProduit($this);
}
return $this;
}
public function removeDevi(Devis $devi): self
{
if ($this->devis->removeElement($devi)) {
// set the owning side to null (unless already changed)
if ($devi->getProduit() === $this) {
$devi->setProduit(null);
}
}
return $this;
}
public function getCodeProduit(): ?string
{
return $this->codeProduit;
}
public function setCodeProduit(string $codeProduit): self
{
$this->codeProduit = $codeProduit;
return $this;
}
public function getLogo(): ?string
{
return $this->logo;
}
public function setLogo(string $logo): self
{
$this->logo = $logo;
return $this;
}
public function getPrixDeVente(): ?float
{
return $this->prixDeVente;
}
public function setPrixDeVente(float $prixDeVente): self
{
$this->prixDeVente = $prixDeVente;
return $this;
}
public function getEtat(): ?string
{
return $this->etat;
}
public function setEtat(string $etat): self
{
$this->etat = $etat;
return $this;
}
public function getCodeBarre(): ?string
{
return $this->codeBarre;
}
public function setCodeBarre(string $codeBarre): self
{
$this->codeBarre = $codeBarre;
return $this;
}
/**
* @return Collection<int, ImageProduit>
*/
public function getImageProduits(): Collection
{
return $this->imageProduits;
}
public function addImageProduit(ImageProduit $imageProduit): self
{
if (!$this->imageProduits->contains($imageProduit)) {
$this->imageProduits[] = $imageProduit;
$imageProduit->setProduit($this);
}
return $this;
}
public function removeImageProduit(ImageProduit $imageProduit): self
{
if ($this->imageProduits->removeElement($imageProduit)) {
// set the owning side to null (unless already changed)
if ($imageProduit->getProduit() === $this) {
$imageProduit->setProduit(null);
}
}
return $this;
}
/**
* @return Collection<int, Stock>
*/
public function getStocks(): Collection
{
return $this->stocks;
}
public function addStock(Stock $stock): self
{
if (!$this->stocks->contains($stock)) {
$this->stocks[] = $stock;
$stock->setProduit($this);
}
return $this;
}
public function removeStock(Stock $stock): self
{
if ($this->stocks->removeElement($stock)) {
// set the owning side to null (unless already changed)
if ($stock->getProduit() === $this) {
$stock->setProduit(null);
}
}
return $this;
}
public function getApn(): ?string
{
return $this->apn;
}
public function setApn(string $apn): self
{
$this->apn = $apn;
return $this;
}
public function getRom(): ?string
{
return $this->rom;
}
public function setRom(?string $rom): self
{
$this->rom = $rom;
return $this;
}
public function getRam(): ?int
{
return $this->ram;
}
public function setRam(?int $ram): self
{
$this->ram = $ram;
return $this;
}
public function getImei(): ?string
{
return $this->imei;
}
public function setImei(string $imei): self
{
$this->imei = $imei;
return $this;
}
/**
* Get the value of producer
*/
public function getProducer()
{
return $this->producer;
}
/**
* Set the value of producer
*
* @return self
*/
public function setProducer($producer)
{
$this->producer = $producer;
return $this;
}
/**
* Get the value of model
*/
public function getModel()
{
return $this->model;
}
/**
* Set the value of model
*
* @return self
*/
public function setModel($model)
{
$this->model = $model;
return $this;
}
/**
* Get the value of realeaseYear
*/
public function getRealeaseYear()
{
return $this->realeaseYear;
}
/**
* Set the value of realeaseYear
*
* @return self
*/
public function setRealeaseYear($realeaseYear)
{
$this->realeaseYear = $realeaseYear;
return $this;
}
/**
* Get the value of os
*/
public function getOs()
{
return $this->os;
}
/**
* Set the value of os
*
* @return self
*/
public function setOs($os)
{
$this->os = $os;
return $this;
}
/**
* Get the value of chipset
*/
public function getChipset()
{
return $this->chipset;
}
/**
* Set the value of chipset
*
* @return self
*/
public function setChipset($chipset)
{
$this->chipset = $chipset;
return $this;
}
/**
* Get the value of numberCpuCore
*/
public function getNumberCpuCore()
{
return $this->numberCpuCore;
}
/**
* Set the value of numberCpuCore
*
* @return self
*/
public function setNumberCpuCore($numberCpuCore)
{
$this->numberCpuCore = $numberCpuCore;
return $this;
}
/**
* Get the value of internalMemory
*/
public function getInternalMemory()
{
return $this->internalMemory;
}
/**
* Set the value of internalMemory
*
* @return self
*/
public function setInternalMemory($internalMemory)
{
$this->internalMemory = $internalMemory;
return $this;
}
/**
* Get the value of batteryCapacity
*/
public function getBatteryCapacity()
{
return $this->batteryCapacity;
}
/**
* Set the value of batteryCapacity
*
* @return self
*/
public function setBatteryCapacity($batteryCapacity)
{
$this->batteryCapacity = $batteryCapacity;
return $this;
}
/**
* Get the value of removaleBattery
*/
public function getRemovaleBattery()
{
return $this->removaleBattery;
}
/**
* Set the value of removaleBattery
*
* @return self
*/
public function setRemovaleBattery($removaleBattery)
{
$this->removaleBattery = $removaleBattery;
return $this;
}
/**
* Get the value of displayType
*/
public function getDisplayType()
{
return $this->displayType;
}
/**
* Set the value of displayType
*
* @return self
*/
public function setDisplayType($displayType)
{
$this->displayType = $displayType;
return $this;
}
/**
* Get the value of builtInGps
*/
public function getBuiltInGps()
{
return $this->builtInGps;
}
/**
* Set the value of builtInGps
*
* @return self
*/
public function setBuiltInGps($builtInGps)
{
$this->builtInGps = $builtInGps;
return $this;
}
/**
* Get the value of bluetoothVersion
*/
public function getBluetoothVersion()
{
return $this->bluetoothVersion;
}
/**
* Set the value of bluetoothVersion
*
* @return self
*/
public function setBluetoothVersion($bluetoothVersion)
{
$this->bluetoothVersion = $bluetoothVersion;
return $this;
}
/**
* Get the value of displayPixelDensity
*/
public function getDisplayPixelDensity()
{
return $this->displayPixelDensity;
}
/**
* Set the value of displayPixelDensity
*
* @return self
*/
public function setDisplayPixelDensity($displayPixelDensity)
{
$this->displayPixelDensity = $displayPixelDensity;
return $this;
}
/**
* Get the value of displayColors
*/
public function getDisplayColors()
{
return $this->displayColors;
}
/**
* Set the value of displayColors
*
* @return self
*/
public function setDisplayColors($displayColors)
{
$this->displayColors = $displayColors;
return $this;
}
/**
* Get the value of builtInNfc
*/
public function getBuiltInNfc()
{
return $this->builtInNfc;
}
/**
* Set the value of builtInNfc
*
* @return self
*/
public function setBuiltInNfc($builtInNfc)
{
$this->builtInNfc = $builtInNfc;
return $this;
}
/**
* Get the value of selfieCameraResolution
*/
public function getSelfieCameraResolution()
{
return $this->selfieCameraResolution;
}
/**
* Set the value of selfieCameraResolution
*
* @return self
*/
public function setSelfieCameraResolution($selfieCameraResolution)
{
$this->selfieCameraResolution = $selfieCameraResolution;
return $this;
}
/**
* Get the value of mainCameraResolution
*/
public function getMainCameraResolution()
{
return $this->mainCameraResolution;
}
/**
* Set the value of mainCameraResolution
*
* @return self
*/
public function setMainCameraResolution($mainCameraResolution)
{
$this->mainCameraResolution = $mainCameraResolution;
return $this;
}
/**
* Get the value of displayDiagonal
*/
public function getDisplayDiagonal()
{
return $this->displayDiagonal;
}
/**
* Set the value of displayDiagonal
*
* @return self
*/
public function setDisplayDiagonal($displayDiagonal)
{
$this->displayDiagonal = $displayDiagonal;
return $this;
}
/**
* Get the value of batteryType
*/
public function getBatteryType()
{
return $this->batteryType;
}
/**
* Set the value of batteryType
*
* @return self
*/
public function setBatteryType($batteryType)
{
$this->batteryType = $batteryType;
return $this;
}
/**
* Get the value of bluetoothFeatures
*/
public function getBluetoothFeatures()
{
return $this->bluetoothFeatures;
}
/**
* Set the value of bluetoothFeatures
*
* @return self
*/
public function setBluetoothFeatures($bluetoothFeatures)
{
$this->bluetoothFeatures = $bluetoothFeatures;
return $this;
}
/**
* Get the value of mainCameraFeatures
*/
public function getMainCameraFeatures()
{
return $this->mainCameraFeatures;
}
/**
* Set the value of mainCameraFeatures
*
* @return self
*/
public function setMainCameraFeatures($mainCameraFeatures)
{
$this->mainCameraFeatures = $mainCameraFeatures;
return $this;
}
/**
* Get the value of otherDisplayFeatures
*/
public function getOtherDisplayFeatures()
{
return $this->otherDisplayFeatures;
}
/**
* Set the value of otherDisplayFeatures
*
* @return self
*/
public function setOtherDisplayFeatures($otherDisplayFeatures)
{
$this->otherDisplayFeatures = $otherDisplayFeatures;
return $this;
}
/**
* Get the value of displayScreenToBodyRatio
*/
public function getDisplayScreenToBodyRatio()
{
return $this->displayScreenToBodyRatio;
}
/**
* Set the value of displayScreenToBodyRatio
*
* @return self
*/
public function setDisplayScreenToBodyRatio($displayScreenToBodyRatio)
{
$this->displayScreenToBodyRatio = $displayScreenToBodyRatio;
return $this;
}
/**
* Get the value of displayResolution
*/
public function getDisplayResolution()
{
return $this->displayResolution;
}
/**
* Set the value of displayResolution
*
* @return self
*/
public function setDisplayResolution($displayResolution)
{
$this->displayResolution = $displayResolution;
return $this;
}
/**
* Get the value of builtInBluetooth
*/
public function getBuiltInBluetooth()
{
return $this->builtInBluetooth;
}
/**
* Set the value of builtInBluetooth
*
* @return self
*/
public function setBuiltInBluetooth($builtInBluetooth)
{
$this->builtInBluetooth = $builtInBluetooth;
return $this;
}
/**
* Get the value of wifiFeatures
*/
public function getWifiFeatures()
{
return $this->wifiFeatures;
}
/**
* Set the value of wifiFeatures
*
* @return self
*/
public function setWifiFeatures($wifiFeatures)
{
$this->wifiFeatures = $wifiFeatures;
return $this;
}
/**
* Get the value of wifiVersion
*/
public function getWifiVersion()
{
return $this->wifiVersion;
}
/**
* Set the value of wifiVersion
*
* @return self
*/
public function setWifiVersion($wifiVersion)
{
$this->wifiVersion = $wifiVersion;
return $this;
}
/**
* @return Collection<int, ProduitIMEI>
*/
public function getProduitIMEIs(): Collection
{
return $this->produitIMEIs;
}
public function addProduitIMEI(ProduitIMEI $produitIMEI): self
{
if (!$this->produitIMEIs->contains($produitIMEI)) {
$this->produitIMEIs[] = $produitIMEI;
$produitIMEI->setProduit($this);
}
return $this;
}
/**
* Get the value of builtInWifi
*/
public function getBuiltInWifi()
{
return $this->builtInWifi;
}
/**
* Set the value of builtInWifi
*
* @return self
*/
public function setBuiltInWifi($builtInWifi)
{
$this->builtInWifi = $builtInWifi;
return $this;
}
public function removeProduitIMEI(ProduitIMEI $produitIMEI): self
{
if ($this->produitIMEIs->removeElement($produitIMEI)) {
// set the owning side to null (unless already changed)
if ($produitIMEI->getProduit() === $this) {
$produitIMEI->setProduit(null);
}
}
return $this;
}
/**
* Get the value of usbVersion
*/
public function getUsbVersion()
{
return $this->usbVersion;
}
/**
* Set the value of usbVersion
*
* @return self
*/
public function setUsbVersion($usbVersion)
{
$this->usbVersion = $usbVersion;
return $this;
}
/**
* Get the value of usbConnectorType
*/
public function getUsbConnectorType()
{
return $this->usbConnectorType;
}
/**
* Set the value of usbConnectorType
*
* @return self
*/
public function setUsbConnectorType($usbConnectorType)
{
$this->usbConnectorType = $usbConnectorType;
return $this;
}
/**
* Get the value of weight
*/
public function getWeight()
{
return $this->weight;
}
/**
* Set the value of weight
*
* @return self
*/
public function setWeight($weight)
{
$this->weight = $weight;
return $this;
}
/**
* Get the value of thickness
*/
public function getThickness()
{
return $this->thickness;
}
/**
* Set the value of thickness
*
* @return self
*/
public function setThickness($thickness)
{
$this->thickness = $thickness;
return $this;
}
/**
* Get the value of height
*/
public function getHeight()
{
return $this->height;
}
/**
* Set the value of height
*
* @return self
*/
public function setHeight($height)
{
$this->height = $height;
return $this;
}
/**
* Get the value of width
*/
public function getWidth()
{
return $this->width;
}
/**
* Set the value of width
*
* @return self
*/
public function setWidth($width)
{
$this->width = $width;
return $this;
}
/**
* Get the value of availableColors
*/
public function getAvailableColors()
{
return $this->availableColors;
}
/**
* Set the value of availableColors
*
* @return self
*/
public function setAvailableColors($availableColors)
{
$this->availableColors = $availableColors;
return $this;
}
/**
* Get the value of gpuClock
*/
public function getGpuClock()
{
return $this->gpuClock;
}
/**
* Set the value of gpuClock
*
* @return self
*/
public function setGpuClock($gpuClock)
{
$this->gpuClock = $gpuClock;
return $this;
}
/**
* Get the value of gpuName
*/
public function getGpuName()
{
return $this->gpuName;
}
/**
* Set the value of gpuName
*
* @return self
*/
public function setGpuName($gpuName)
{
$this->gpuName = $gpuName;
return $this;
}
/**
* Get the value of memoryCardType
*/
public function getMemoryCardType()
{
return $this->memoryCardType;
}
/**
* Set the value of memoryCardType
*
* @return self
*/
public function setMemoryCardType($memoryCardType)
{
$this->memoryCardType = $memoryCardType;
return $this;
}
public static function loadByData(array $data, Produit $produit = null)
{
$produit = null != $produit ? $produit : new Produit();
$apn = [];
$typeapn = "";
foreach ($data as $d) {
$key = $d[0];
switch ($key) {
case 'Main Camera':
$typeapn = 'mc';
break;
case 'Selfie Camera':
$typeapn = 'sc';
break;
case 'IMEI Number': // IMEI
if (isset($d[1])) {
$produit->setImei($d[1]);
}
break;
case 'Producer': // Producer
if (isset($d[1])) {
$produit->setProducer($d[1]);
}
break;
case 'Model': // Model
if (isset($d[1])) {
$produit->setModel($d[1]);
}
break;
case 'Release year': // Release year
if (isset($d[1])) {
$produit->setRealeaseYear($d[1]);
}
break;
case 'Operating System': // OS
if (isset($d[1])) {
$produit->setOs($d[1]);
}
break;
case 'Chipset': // Chipset
if (isset($d[1])) {
$produit->setChipset($d[1]);
}
break;
case 'Number of CPU Cores': // Number of CPU Cores
if (isset($d[1])) {
$produit->setNumberCpuCore($d[1]);
}
break;
case 'RAM': // Ram
if (isset($d[1])) {
$produit->setRam(str_replace(' GB', '', $d[1]));
}
break;
case 'Internal Memory': // Internal Memory
if (isset($d[1])) {
$produit->setInternalMemory($d[1]);
$produit->setRom($d[1]);
}
break;
case 'Memory Card Type': // Memory Card Type
if (isset($d[1])) {
$produit->setMemoryCardType($d[1]);
}
break;
case 'GPU Name': // GPU Name
if (isset($d[1])) {
$produit->setGpuName($d[1]);
}
break;
case 'GPU Clock': // GPU Clock
if (isset($d[1])) {
$produit->setGpuClock($d[1]);
}
break;
case 'Available Colors': // Available colors
if (isset($d[1])) {
$produit->setAvailableColors($d[1]);
}
break;
case 'Width': // Width
if (isset($d[1])) {
$produit->setWidth($d[1]);
}
break;
case 'Height': // Height
if (isset($d[1])) {
$produit->setHeight($d[1]);
}
break;
case 'Thickness': // Thickness
if (isset($d[1])) {
$produit->setThickness($d[1]);
}
break;
case 'Weight': // Weight
if (isset($d[1])) {
$produit->setWeight($d[1]);
}
break;
case 'USB Conector Type': // USB Conector Type
if (isset($d[1])) {
$produit->setUsbConnectorType($d[1]);
}
break;
case 'USB Version': // USB Version
if (isset($d[1])) {
$produit->setUsbVersion($d[1]);
}
break;
case 'Built-in WiFi': // Built-in WiFi
if (isset($d[1])) {
$produit->setBuiltInWifi($d[1]);
}
break;
case 'WiFi Version': // WiFi Version
if (isset($d[1])) {
$produit->setWifiVersion($d[1]);
}
break;
case 'WiFi Features': // WiFi Features
if (isset($d[1])) {
$produit->setWifiFeatures($d[1]);
}
break;
case 'Built-in bluetooth': // Built-in bluetooth
if (isset($d[1])) {
$produit->setBuiltInBluetooth($d[1]);
}
break;
case 'Bluetooth Features': // Bluetooth Features
if (isset($d[1])) {
$produit->setBluetoothFeatures($d[1]);
}
break;
case 'Bluetooth Version': // Bluetooth Version
if (isset($d[1])) {
$produit->setBluetoothVersion($d[1]);
}
break;
case 'Built-in NFC': // Built-in NFC
if (isset($d[1])) {
$produit->setBuiltInNfc($d[1]);
}
break;
case 'Built-in GPS': // Built-in Gps
if (isset($d[1])) {
$produit->setBuiltInGps($d[1]);
}
break;
case 'Type': // Display type
if (isset($d[1])) {
$produit->setDisplayType($d[1]);
}
break;
case 'Diagonal': // Display diagonal
if (isset($d[1])) {
$produit->setDisplayDiagonal($d[1]);
}
break;
case 'Resolution': // Display resolution
if ('mc'==$typeapn) {
if (isset($d[1])) {
$produit->setMainCameraResolution($d[1]);
$apn[] = $d[1];
}
} elseif ('sc'==$typeapn) {
if (isset($d[1])) {
$produit->setSelfieCameraResolution($d[1]);
$apn[] = $d[1];
}
} else {
if (isset($d[1])) {
$produit->setDisplayResolution($d[1]);
}
}
break;
case 'Screen-to-body ratio': // Display Screen-to-body ratio
if (isset($d[1])) {
$produit->setDisplayScreenToBodyRatio($d[1]);
}
break;
case 'Pixel density': // Display Pixel density
if (isset($d[1])) {
$produit->setDisplayPixelDensity($d[1]);
}
break;
case 'Colors': // Display colors
if (isset($d[1])) {
$produit->setDisplayColors($d[1]);
}
break;
case 'Other display Features': // Other display Features
if (isset($d[1])) {
$produit->setOtherDisplayFeatures($d[1]);
}
break;
// case 'Resolution': // Main camera resolution
// if(isset($d[1])) {
// $produit->setMainCameraResolution($d[1]);
// $apn[] = $d[1];
// }
// break;
case 'Features': // Main camera features
if (isset($d[1])) {
$produit->setMainCameraFeatures($d[1]);
}
break;
// case 'Resolution': // Selfie camera resolution
// if(isset($d[1])) {
// $produit->setSelfieCameraResolution($d[1]);
// $apn[] = $d[1];
// }
// break;
case 'Capacity': // Battery capacity
if (isset($d[1])) {
$produit->setBatteryCapacity($d[1]);
}
break;
case 'Type': // Battery type
if (isset($d[1])) {
$produit->setBatteryType($d[1]);
}
break;
case 'Removable battery': // Removable battery
if (isset($d[1])) {
$produit->setRemovaleBattery($d[1]);
}
break;
default:
# code...
break;
}
}
$produit->setNom($data[3][1] . ' ' . $data[2][1]);
$produit->setApn(implode('/', $apn));
return $produit;
}
/**
* @return Collection<int, FactureProduit>
*/
public function getFactureProduits(): Collection
{
return $this->factureProduits;
}
public function addFactureProduit(FactureProduit $factureProduit): self
{
if (!$this->factureProduits->contains($factureProduit)) {
$this->factureProduits[] = $factureProduit;
$factureProduit->setProduit($this);
}
return $this;
}
public function removeFactureProduit(FactureProduit $factureProduit): self
{
if ($this->factureProduits->removeElement($factureProduit)) {
// set the owning side to null (unless already changed)
if ($factureProduit->getProduit() === $this) {
$factureProduit->setProduit(null);
}
}
return $this;
}
/**
* @return Collection<int, BLProduit>
*/
public function getBLProduits(): Collection
{
return $this->bLProduits;
}
public function addBLProduit(BLProduit $bLProduit): self
{
if (!$this->bLProduits->contains($bLProduit)) {
$this->bLProduits[] = $bLProduit;
$bLProduit->setProduit($this);
}
return $this;
}
public function removeBLProduit(BLProduit $bLProduit): self
{
if ($this->bLProduits->removeElement($bLProduit)) {
// set the owning side to null (unless already changed)
if ($bLProduit->getProduit() === $this) {
$bLProduit->setProduit(null);
}
}
return $this;
}
/**
* @return Collection<int, ProduitTransferer>
*/
public function getProduitTransferers(): Collection
{
return $this->produitTransferers;
}
public function addProduitTransferer(ProduitTransferer $produitTransferer): self
{
if (!$this->produitTransferers->contains($produitTransferer)) {
$this->produitTransferers[] = $produitTransferer;
$produitTransferer->setProduit($this);
}
return $this;
}
public function removeProduitTransferer(ProduitTransferer $produitTransferer): self
{
if ($this->produitTransferers->removeElement($produitTransferer)) {
// set the owning side to null (unless already changed)
if ($produitTransferer->getProduit() === $this) {
$produitTransferer->setProduit(null);
}
}
return $this;
}
public function getRoyalties(): ?float
{
return $this->royalties;
}
public function setRoyalties(?float $royalties): self
{
$this->royalties = $royalties;
return $this;
}
/**
* Get the value of totalStock
*/
public function getTotalStock()
{
return $this->totalStock;
}
/**
* Set the value of totalStock
*
* @return self
*/
public function setTotalStock($totalStock)
{
$this->totalStock = $totalStock;
return $this;
}
/**
* Get the value of totalVente
*/
public function getTotalVente()
{
return $this->totalVente;
}
/**
* Set the value of totalVente
*
* @return self
*/
public function setTotalVente($totalVente)
{
$this->totalVente = $totalVente;
return $this;
}
/**
* @return Collection<int, Changeroyalties>
*/
public function getChangeroyalties(): Collection
{
return $this->changeroyalties;
}
public function addChangeroyalty(Changeroyalties $changeroyalty): self
{
if (!$this->changeroyalties->contains($changeroyalty)) {
$this->changeroyalties[] = $changeroyalty;
$changeroyalty->setProduit($this);
}
return $this;
}
public function removeChangeroyalty(Changeroyalties $changeroyalty): self
{
if ($this->changeroyalties->removeElement($changeroyalty)) {
// set the owning side to null (unless already changed)
if ($changeroyalty->getProduit() === $this) {
$changeroyalty->setProduit(null);
}
}
return $this;
}
public function getCorrespondanceProduit($codeBarre = null): string
{
return isset((self::CORREPONDANCE_PRODUITS)[$codeBarre]) ? (self::CORREPONDANCE_PRODUITS)[$codeBarre] : "";
}
public function getDetailCommande(): ?DetailCommande
{
return $this->detailCommande;
}
public function setDetailCommande(?DetailCommande $detailCommande): self
{
$this->detailCommande = $detailCommande;
return $this;
}
/**
* @return Collection<int, DetailCommande>
*/
public function getDetailCommandes(): Collection
{
return $this->detailCommandes;
}
public function addDetailCommande(DetailCommande $detailCommande): self
{
if (!$this->detailCommandes->contains($detailCommande)) {
$this->detailCommandes[] = $detailCommande;
$detailCommande->setProduit($this);
}
return $this;
}
public function removeDetailCommande(DetailCommande $detailCommande): self
{
if ($this->detailCommandes->removeElement($detailCommande)) {
// set the owning side to null (unless already changed)
if ($detailCommande->getProduit() === $this) {
$detailCommande->setProduit(null);
}
}
return $this;
}
}