<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* NoteSupportVend
*
* @ORM\Table(name="note_support_vend", indexes={@ORM\Index(name="fk_auteur_id", columns={"auteur_id"}), @ORM\Index(name="fk_produit_id", columns={"produit_id"})})
* @ORM\Entity(repositoryClass="App\Repository\NoteSupportVendRepository")
*/
class NoteSupportVend
{
/**
* @var int
*
* @ORM\Column(name="note_id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $noteId;
/**
* @var \DateTime
*
* @ORM\Column(name="note_date", type="date", nullable=false)
*/
private $noteDate;
/**
* @var string
*
* @ORM\Column(name="note_numero", type="string", length=10, nullable=false, options={"fixed"=true})
*/
private $noteNumero;
/**
* @var string
*
* @ORM\Column(name="note_chantier", type="string", length=255, nullable=false)
*/
private $noteChantier;
/**
* @var string
*
* @ORM\Column(name="note_client", type="string", length=255, nullable=false)
*/
private $noteClient;
/**
* @var int
*
* @ORM\Column(name="note_ch_expl", type="integer", nullable=false)
*/
private $noteChExpl;
/**
* @var int
*
* @ORM\Column(name="note_ch_perm", type="integer", nullable=false)
*/
private $noteChPerm;
/**
* @var string|null
*
* @ORM\Column(name="note_detail_perm", type="string", length=255, nullable=true)
*/
private $noteDetailPerm;
/**
* @var string|null
*
* @ORM\Column(name="note_detail_neige", type="string", length=255, nullable=true)
*/
private $noteDetailNeige;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="notesSupportVend")
* @ORM\JoinColumn(name="auteur_id", referencedColumnName="user_id", nullable=true)
*/
private $auteur;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Support", inversedBy="notesSupportVend")
* @ORM\JoinColumn(name="produit_id", referencedColumnName="profil_id", nullable=true)
*/
private $produit;
/**
* @var int
*
* @ORM\Column(name="produit_id", type="integer", nullable=false)
*/
private $produitId;
/**
* @var int
*
* @ORM\Column(name="auteur_id", type="integer", nullable=false)
*/
private $auteurId;
/**
* @ORM\Column(name="portees", type="json", nullable=false)
*/
private $notePortees=[];
public function getId(): ?int
{
return $this->noteId;
}
public function getNoteId(): ?int
{
return $this->noteId;
}
public function getNoteDate(): ?\DateTimeInterface
{
return $this->noteDate;
}
public function getDate(): ?\DateTimeInterface
{
return $this->noteDate;
}
public function setNoteDate(\DateTimeInterface $noteDate): self
{
$this->noteDate = $noteDate;
return $this;
}
public function setDate(\DateTimeInterface $noteDate): self
{
$this->noteDate = $noteDate;
return $this;
}
public function getNoteNumero(): ?string
{
return $this->noteNumero;
}
public function getNumero(): ?string
{
return $this->getNoteNumero();
}
public function setNoteNumero( $noteNumero): self
{
$this->noteNumero = $noteNumero;
return $this;
}
public function getNoteChantier(): ?string
{
return $this->noteChantier;
}
public function getChantier(): ?string
{
return $this->getNoteChantier();
}
public function getAuteur(): ?User
{
return $this->auteur;
}
public function setAuteur(?User $auteur): self
{
$this->auteur = $auteur;
return $this;
}
public function getProduit(): ?Support
{
return $this->produit;
}
public function setProduit(?Support $produit): self
{
$this->produit = $produit;
return $this;
}
/** */
public function setNoteChantier( $noteChantier): self
{
$this->noteChantier = $noteChantier;
return $this;
}
public function getNoteClient(): ?string
{
return $this->noteClient;
}
public function setNoteClient( $noteClient): self
{
$this->noteClient = $noteClient;
return $this;
}
public function getNoteChExpl(): ?int
{
return $this->noteChExpl;
}
public function setNoteChExpl(int $noteChExpl): self
{
$this->noteChExpl = $noteChExpl;
return $this;
}
public function getNoteChPerm(): ?int
{
return $this->noteChPerm;
}
public function setNoteChPerm(int $noteChPerm): self
{
$this->noteChPerm = $noteChPerm;
return $this;
}
public function getNoteDetailPerm(): ?string
{
return $this->noteDetailPerm;
}
public function setNoteDetailPerm( $noteDetailPerm): self
{
$this->noteDetailPerm = $noteDetailPerm;
return $this;
}
public function getNoteDetailNeige(): ?string
{
return $this->noteDetailNeige;
}
public function setNoteDetailNeige( $noteDetailNeige): self
{
$this->noteDetailNeige = $noteDetailNeige;
return $this;
}
/** */
public function setChantier( $noteChantier): self
{
$this->noteChantier = $noteChantier;
return $this;
}
public function getClient(): ?string
{
return $this->noteClient;
}
public function setClient( $noteClient): self
{
$this->noteClient = $noteClient;
return $this;
}
public function getChExpl(): ?int
{
return $this->noteChExpl;
}
public function setChExpl(int $noteChExpl): self
{
$this->noteChExpl = $noteChExpl;
return $this;
}
public function getChPerm(): ?int
{
return $this->noteChPerm;
}
public function setChPerm(int $noteChPerm): self
{
$this->noteChPerm = $noteChPerm;
return $this;
}
public function getDetailPerm()
{
return json_decode($this->noteDetailPerm);
}
public function setDetailPerm( $noteDetailPerm): self
{
$this->noteDetailPerm = $noteDetailPerm;
return $this;
}
public function getDetailNeige() //Modification du code suite à des bugs type erreur 500
{
return json_decode($this->noteDetailNeige);
}
public function setDetailNeige( $noteDetailNeige): self
{
$this->noteDetailNeige = $noteDetailNeige;
return $this;
}
public function getProduitId(): ?int
{
return $this->produitId;
}
public function setProduitId(int $produitId): self
{
$this->produitId = $produitId;
return $this;
}
public function getAuteurId(): ?int
{
return $this->auteurId;
}
public function setAuteurId(int $auteurId): self
{
$this->auteurId = $auteurId;
return $this;
}
public function getPortees():array
{
return $this->notePortees??[];
}
public function setPortees( array $portees)
{
$this->notePortees = $portees;
}
public function dessinStructure($hauteurDessin, $largeurDessin)
{
$lDess = $largeurDessin;
$hDess = $hauteurDessin;
$L = $this->notePortees; // tableau des longueurs
$nbL = count($L);
$h = 10;
$lApp = 40;
$hApp = 40;
$margeX = 20;
$margeY = 15;
$decalageTrait = 10;
$echX = ($lDess - (2 * $margeX + $lApp)) / array_sum($L);
$echY = ($hDess - (3 * $margeY + $hApp + 12 * $decalageTrait)) / $h;
$x0 = round($margeX + $lApp / 2);
$y0 = round(2 * $margeY);
$appuis = [];
for ($i = 0; $i <= $nbL; $i++) {
$xi = $x0 + round(array_sum(array_slice($L, 0, $i)) * $echX);
$appuis[] = [
'points' => sprintf('%f,%f %f,%f %f,%f',
$xi - $lApp / 2, $y0 + $h * $echY + $hApp,
$xi, $y0 + $h * $echY,
$xi + $lApp / 2, $y0 + $h * $echY + $hApp
),
'x' => $xi
];
}
$travees = [];
for ($i = 0; $i < count($appuis) - 1; $i++) {
$travees[] = [
'x1' => $appuis[$i]['x'],
'x2' => $appuis[$i + 1]['x'],
'y' => $y0 + $h * $echY,
'longueur' => $L[$i] // longueur réelle
];
}
return [
'appuis' => $appuis,
'travees' => $travees
];
}
/**
* Summary of noteEpaisseur
* @ORM\Column(type="float", nullable=true)
*/
private $noteEpaisseur;
public function setEpaisseur($epaisseur):self
{
$this->noteEpaisseur = (float)$epaisseur;
return $this;
}
//public function setNoteEpaisseur( $noteEpaisseur): self
//{
// $this->noteEpaisseur = $noteEpaisseur;
//
// return $this;
//}
public function getEpaisseur():?float
{
return $this->noteEpaisseur;
}
//public function getNoteEpaisseur( ): self
//{
// return json_decode($this->noteEpaisseur);
//}
}