src/Entity/GestionComerciale/StatutCommande.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Entity\GestionComerciale;
  3. use App\Entity\Utilisateur\Utilisateur;
  4. use DateTime;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Gedmo\Mapping\Annotation as Gedmo;
  9. use Symfony\Component\Validator\Constraints as Assert;
  10. use App\Annotations\SecuredEntity;
  11. /**
  12.  * StatutCommande
  13.  *
  14.  * @ORM\Table("commerciale__statut_commande")
  15.  * @ORM\Entity(repositoryClass="App\Repository\GestionComerciale\StatutCommandeRepository")
  16.  * @Gedmo\SoftDeleteable(fieldName="dateSuppression",timeAware=false)
  17.  * @SecuredEntity(name="Statut de commande", group="REGLAGES")
  18.  */
  19. class StatutCommande
  20. {
  21.     /**
  22.      * @ORM\Column(name="id", type="integer")
  23.      * @ORM\Id
  24.      * @ORM\GeneratedValue(strategy="AUTO")
  25.      */
  26.     private $id;
  27.     /**
  28.      * @ORM\Column(name="document_commercial_id", type="integer")
  29.      */
  30.     private $documentCommercial;
  31.     /**
  32.      * @ORM\OneToMany(targetEntity="App\Entity\GestionComerciale\Commande", mappedBy="statutCommande")
  33.      */
  34.     private $commandes;
  35.     /**
  36.      * @ORM\ManyToOne(targetEntity="App\Entity\GestionComerciale\StatutCommande")
  37.      */
  38.     private $actionStatutCommande;
  39.     /**
  40.      * @ORM\Column(name="ordre", type="integer", nullable=true)
  41.      */
  42.     private $ordre;
  43.     /**
  44.      * @ORM\ManyToOne(targetEntity="App\Entity\Utilisateur\Utilisateur", inversedBy="statutCommande")
  45.      * @ORM\JoinColumn(nullable=true)
  46.      */
  47.     private $utilisateur;
  48.     /**
  49.      * @ORM\Column(name="libelle", type="string", length=255, nullable=true)
  50.      * @Assert\NotBlank(message="Libellé obligatoire")
  51.      */
  52.     private $libelle;
  53.     /**
  54.      * @ORM\Column(name="date", type="datetime", nullable=true)
  55.      */
  56.     private $date;
  57.     /**
  58.      * @ORM\Column(name="dateMaj", type="datetime", nullable=true)
  59.      * @Gedmo\Timestampable(on="update")
  60.      */
  61.     private $dateMaj;
  62.     /**
  63.      * @ORM\Column(name="dateSuppression", type="datetime", nullable=true)
  64.      */
  65.     private $dateSuppression;
  66.     public function __construct()
  67.     {
  68.         $this->date = new Datetime();
  69.         $this->ordre 0;
  70.         $this->commandes = new ArrayCollection();
  71.     }
  72.     public function getId(): int
  73.     {
  74.         return $this->id;
  75.     }
  76.     public function setLibelle(?string $libelle): StatutCommande
  77.     {
  78.         $this->libelle $libelle;
  79.         return $this;
  80.     }
  81.     public function getLibelle(): ?string
  82.     {
  83.         return $this->libelle;
  84.     }
  85.     public function getLibelleNettoye(): ?string
  86.     {
  87.         return $this->nettoyage($this->libelle);
  88.     }
  89.     public function setDate(?DateTime $date): StatutCommande
  90.     {
  91.         $this->date $date;
  92.         return $this;
  93.     }
  94.     public function getDate(): ?DateTime
  95.     {
  96.         return $this->date;
  97.     }
  98.     public function setDateMaj(?DateTime $dateMaj): StatutCommande
  99.     {
  100.         $this->dateMaj $dateMaj;
  101.         return $this;
  102.     }
  103.     public function getDateMaj(): ?DateTime
  104.     {
  105.         return $this->dateMaj;
  106.     }
  107.     public function setDateSuppression(?DateTime $dateSuppression): StatutCommande
  108.     {
  109.         $this->dateSuppression $dateSuppression;
  110.         return $this;
  111.     }
  112.     public function getDateSuppression(): ?DateTime
  113.     {
  114.         return $this->dateSuppression;
  115.     }
  116.     public function setUtilisateur(?Utilisateur $utilisateur): StatutCommande
  117.     {
  118.         $this->utilisateur $utilisateur;
  119.         return $this;
  120.     }
  121.     public function getUtilisateur(): ?Utilisateur
  122.     {
  123.         return $this->utilisateur;
  124.     }
  125.     public function addCommande(Commande $commandes): StatutCommande
  126.     {
  127.         $this->commandes[] = $commandes;
  128.         return $this;
  129.     }
  130.     public function removeCommande(Commande $commandes)
  131.     {
  132.         $this->commandes->removeElement($commandes);
  133.     }
  134.     public function getCommandes(): Collection
  135.     {
  136.         return $this->commandes;
  137.     }
  138.     public function __toString()
  139.     {
  140.         return $this->libelle;
  141.     }
  142.     public function setOrdre(?int $ordre): StatutCommande
  143.     {
  144.         $this->ordre $ordre;
  145.         return $this;
  146.     }
  147.     public function getOrdre(): ?int
  148.     {
  149.         return $this->ordre;
  150.     }
  151.     public function setActionStatutCommande(?StatutCommande $actionStatutCommande): StatutCommande
  152.     {
  153.         $this->actionStatutCommande $actionStatutCommande;
  154.         return $this;
  155.     }
  156.     public function getActionStatutCommande(): ?StatutCommande
  157.     {
  158.         return $this->actionStatutCommande;
  159.     }
  160.     private function nettoyage($text)
  161.     {
  162.         $separator "-";
  163.         $tofind "àáâãäåòóôõöøèéêëçìíîïùúûüÿñ"// Lettre accentuées
  164.         $replac "aaaaaaooooooeeeeciiiiuuuuyn"// Equivalent non accentué
  165.         //$text = strtr(strtolower($text),$tofind,$replac);
  166.         $text strtolower($text);
  167.         $text str_replace('é''e'$text);
  168.         $text str_replace(' ''_'$text);
  169.         /*
  170.     $text = ereg_replace("[^a-z0-9.]", $separator, $text);
  171.     while (strstr($text, $separator . $separator))
  172.         $text = str_replace($separator . $separator, $separator, $text);
  173.     if (substr($text, 0, 1) == $separator)
  174.         $text = substr($text, 1);
  175.     return(ereg_replace($separator . "$", "", $text));
  176.          * 
  177.          */
  178.         return $text;
  179.     }
  180.     public function getDocumentCommercial(): ?int
  181.     {
  182.         return $this->documentCommercial;
  183.     }
  184.     public function setDocumentCommercial(int $documentCommercial): self
  185.     {
  186.         $this->documentCommercial $documentCommercial;
  187.         return $this;
  188.     }
  189. }