src/Entity/NoteSupportVend.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. /**
  5.  * NoteSupportVend
  6.  *
  7.  * @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"})})
  8.  * @ORM\Entity(repositoryClass="App\Repository\NoteSupportVendRepository")
  9.  */
  10. class NoteSupportVend
  11. {
  12.     /**
  13.      * @var int
  14.      *
  15.      * @ORM\Column(name="note_id", type="integer", nullable=false)
  16.      * @ORM\Id
  17.      * @ORM\GeneratedValue(strategy="IDENTITY")
  18.      */
  19.     private $noteId;
  20.     /**
  21.      * @var \DateTime
  22.      *
  23.      * @ORM\Column(name="note_date", type="date", nullable=false)
  24.      */
  25.     private $noteDate;
  26.     /**
  27.      * @var string
  28.      *
  29.      * @ORM\Column(name="note_numero", type="string", length=10, nullable=false, options={"fixed"=true})
  30.      */
  31.     private $noteNumero;
  32.     /**
  33.      * @var string
  34.      *
  35.      * @ORM\Column(name="note_chantier", type="string", length=255, nullable=false)
  36.      */
  37.     private $noteChantier;
  38.     /**
  39.      * @var string
  40.      *
  41.      * @ORM\Column(name="note_client", type="string", length=255, nullable=false)
  42.      */
  43.     private $noteClient;
  44.     /**
  45.      * @var int
  46.      *
  47.      * @ORM\Column(name="note_ch_expl", type="integer", nullable=false)
  48.      */
  49.     private $noteChExpl;
  50.     /**
  51.      * @var int
  52.      *
  53.      * @ORM\Column(name="note_ch_perm", type="integer", nullable=false)
  54.      */
  55.     private $noteChPerm;
  56.     /**
  57.      * @var string|null
  58.      *
  59.      * @ORM\Column(name="note_detail_perm", type="string", length=255, nullable=true)
  60.      */
  61.     private $noteDetailPerm;
  62.     /**
  63.      * @var string|null
  64.      *
  65.      * @ORM\Column(name="note_detail_neige", type="string", length=255, nullable=true)
  66.      */
  67.     private $noteDetailNeige;
  68.     /**
  69.      * @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="notesSupportVend")
  70.      * @ORM\JoinColumn(name="auteur_id", referencedColumnName="user_id", nullable=true)
  71.      */
  72.     private $auteur;
  73.     /**
  74.      * @ORM\ManyToOne(targetEntity="App\Entity\Support", inversedBy="notesSupportVend")
  75.      * @ORM\JoinColumn(name="produit_id", referencedColumnName="profil_id", nullable=true)
  76.      */
  77.     private $produit;
  78.      /**
  79.      * @var int
  80.      *
  81.      * @ORM\Column(name="produit_id", type="integer", nullable=false)
  82.      */
  83.     private $produitId;
  84.     /**
  85.      * @var int
  86.      *
  87.      * @ORM\Column(name="auteur_id", type="integer", nullable=false)
  88.      */
  89.     private $auteurId;
  90.     /**
  91.     * @ORM\Column(name="portees", type="json", nullable=false)
  92.     */
  93.     private $notePortees=[];
  94.     public function getId(): ?int
  95.     {
  96.         return $this->noteId;
  97.     }
  98.     public function getNoteId(): ?int
  99.     {
  100.         return $this->noteId;
  101.     }
  102.     public function getNoteDate(): ?\DateTimeInterface
  103.     {
  104.         return $this->noteDate;
  105.     }
  106.     public function getDate(): ?\DateTimeInterface
  107.     {
  108.         return $this->noteDate;
  109.     }
  110.     public function setNoteDate(\DateTimeInterface $noteDate): self
  111.     {
  112.         $this->noteDate $noteDate;
  113.         return $this;
  114.     }
  115.     public function setDate(\DateTimeInterface $noteDate): self
  116.     {
  117.         $this->noteDate $noteDate;
  118.         return $this;
  119.     }
  120.     public function getNoteNumero(): ?string
  121.     {
  122.         return $this->noteNumero;
  123.     }
  124.     public function getNumero(): ?string
  125.     {
  126.         return $this->getNoteNumero();
  127.     }
  128.     public function setNoteNumero$noteNumero): self
  129.     {
  130.         $this->noteNumero $noteNumero;
  131.         return $this;
  132.     }
  133.     public function getNoteChantier(): ?string
  134.     {
  135.         return $this->noteChantier;
  136.     }
  137.     public function getChantier(): ?string
  138.     {
  139.         return $this->getNoteChantier();
  140.     }
  141.     
  142.     public function getAuteur(): ?User
  143.     {
  144.         return $this->auteur;
  145.     }
  146.     public function setAuteur(?User $auteur): self
  147.     {
  148.         $this->auteur $auteur;
  149.         return $this;
  150.     }
  151.     public function getProduit(): ?Support
  152.     {
  153.         return $this->produit;
  154.     }
  155.     public function setProduit(?Support $produit): self
  156.     {
  157.         $this->produit $produit;
  158.         return $this;
  159.     }
  160.     /**  */
  161.     public function setNoteChantier$noteChantier): self
  162.     {
  163.         $this->noteChantier $noteChantier;
  164.         return $this;
  165.     }
  166.     public function getNoteClient(): ?string
  167.     {
  168.         return $this->noteClient;
  169.     }
  170.     public function setNoteClient$noteClient): self
  171.     {
  172.         $this->noteClient $noteClient;
  173.         return $this;
  174.     }
  175.     public function getNoteChExpl(): ?int
  176.     {
  177.         return $this->noteChExpl;
  178.     }
  179.     public function setNoteChExpl(int $noteChExpl): self
  180.     {
  181.         $this->noteChExpl $noteChExpl;
  182.         return $this;
  183.     }
  184.     public function getNoteChPerm(): ?int
  185.     {
  186.         return $this->noteChPerm;
  187.     }
  188.     public function setNoteChPerm(int $noteChPerm): self
  189.     {
  190.         $this->noteChPerm $noteChPerm;
  191.         return $this;
  192.     }
  193.     public function getNoteDetailPerm(): ?string
  194.     {
  195.         return $this->noteDetailPerm;
  196.     }
  197.     public function setNoteDetailPerm$noteDetailPerm): self
  198.     {
  199.         $this->noteDetailPerm $noteDetailPerm;
  200.         return $this;
  201.     }
  202.     public function getNoteDetailNeige(): ?string
  203.     {
  204.         return $this->noteDetailNeige;
  205.     }
  206.     public function setNoteDetailNeige$noteDetailNeige): self
  207.     {
  208.         $this->noteDetailNeige $noteDetailNeige;
  209.         return $this;
  210.     }
  211.     
  212.     /**  */
  213.     public function setChantier$noteChantier): self
  214.     {
  215.         $this->noteChantier $noteChantier;
  216.         return $this;
  217.     }
  218.     public function getClient(): ?string
  219.     {
  220.         return $this->noteClient;
  221.     }
  222.     public function setClient$noteClient): self
  223.     {
  224.         $this->noteClient $noteClient;
  225.         return $this;
  226.     }
  227.     public function getChExpl(): ?int
  228.     {
  229.         return $this->noteChExpl;
  230.     }
  231.     public function setChExpl(int $noteChExpl): self
  232.     {
  233.         $this->noteChExpl $noteChExpl;
  234.         return $this;
  235.     }
  236.     public function getChPerm(): ?int
  237.     {
  238.         return $this->noteChPerm;
  239.     }
  240.     public function setChPerm(int $noteChPerm): self
  241.     {
  242.         $this->noteChPerm $noteChPerm;
  243.         return $this;
  244.     }
  245.     public function getDetailPerm()
  246.     {
  247.         return json_decode($this->noteDetailPerm);
  248.     }
  249.     public function setDetailPerm$noteDetailPerm): self
  250.     {
  251.         $this->noteDetailPerm $noteDetailPerm;
  252.         return $this;
  253.     }
  254.     public function getDetailNeige() //Modification du code suite à des bugs type erreur 500
  255.     {
  256.         return json_decode($this->noteDetailNeige);
  257.     }
  258.     public function setDetailNeige$noteDetailNeige): self
  259.     {
  260.         $this->noteDetailNeige $noteDetailNeige;
  261.         return $this;
  262.     }
  263.     public function getProduitId(): ?int
  264.     {
  265.         return $this->produitId;
  266.     }
  267.     public function setProduitId(int $produitId): self
  268.     {
  269.         $this->produitId $produitId;
  270.         return $this;
  271.     }
  272.     public function getAuteurId(): ?int
  273.     {
  274.         return $this->auteurId;
  275.     }
  276.     public function setAuteurId(int $auteurId): self
  277.     {
  278.         $this->auteurId $auteurId;
  279.         return $this;
  280.     }
  281.     
  282.     public function getPortees():array
  283.     {
  284.          return $this->notePortees??[];
  285.     }
  286.     public function setPortees( array $portees)
  287.     {
  288.         $this->notePortees $portees;
  289.     }
  290.     public function dessinStructure($hauteurDessin$largeurDessin)
  291.     {
  292.         $lDess $largeurDessin;
  293.         $hDess $hauteurDessin;
  294.         $L $this->notePortees// tableau des longueurs
  295.         $nbL count($L);
  296.         $h 10;
  297.         $lApp 40;
  298.         $hApp 40;
  299.         $margeX 20;
  300.         $margeY 15;
  301.         $decalageTrait 10;
  302.         $echX = ($lDess - ($margeX $lApp)) / array_sum($L);
  303.         $echY = ($hDess - ($margeY $hApp 12 $decalageTrait)) / $h;
  304.         $x0 round($margeX $lApp 2);
  305.         $y0 round($margeY);
  306.         $appuis = [];
  307.         for ($i 0$i <= $nbL$i++) {
  308.             $xi $x0 round(array_sum(array_slice($L0$i)) * $echX);
  309.             $appuis[] = [
  310.                 'points' => sprintf('%f,%f %f,%f %f,%f',
  311.                     $xi $lApp 2$y0 $h $echY $hApp,
  312.                     $xi,             $y0 $h $echY,
  313.                     $xi $lApp 2$y0 $h $echY $hApp
  314.                 ),
  315.                 'x' => $xi
  316.             ];
  317.         }
  318.         $travees = [];
  319.         for ($i 0$i count($appuis) - 1$i++) {
  320.             $travees[] = [
  321.                 'x1' => $appuis[$i]['x'],
  322.                 'x2' => $appuis[$i 1]['x'],
  323.                 'y' => $y0 $h $echY,
  324.                 'longueur' => $L[$i// longueur réelle 
  325.             ];
  326.         }
  327.         
  328.         return [
  329.             'appuis' => $appuis,
  330.             'travees' => $travees
  331.         ];
  332.     }
  333.     /**
  334.      * Summary of noteEpaisseur
  335.      * @ORM\Column(type="float", nullable=true)
  336.      */
  337.     private $noteEpaisseur
  338.     public function setEpaisseur($epaisseur):self
  339.     {
  340.         $this->noteEpaisseur = (float)$epaisseur;
  341.         return $this;
  342.     }
  343.     //public function setNoteEpaisseur( $noteEpaisseur): self
  344.     //{
  345.     //    $this->noteEpaisseur = $noteEpaisseur;
  346. //
  347.     //    return $this;
  348.     //}
  349.     public function getEpaisseur():?float
  350.     {
  351.         return $this->noteEpaisseur;
  352.     }
  353.     //public function getNoteEpaisseur( ): self
  354.     //{
  355.     //    return json_decode($this->noteEpaisseur);
  356.     //}
  357.     
  358.     
  359. }