src/Entity/Slave/Product.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Slave;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Table(name="eposm_s_product")
  9.  * @ORM\Entity(repositoryClass="App\Repository\Slave\ProductRepository")
  10.  */
  11. class Product
  12. {    
  13.     public function __toString(){
  14.         return $this->getModel()->getName().' --- '.$this->displayCodes();
  15.     }
  16.     public function toStringShort(){
  17.         $result $this->getModel()->getName();
  18.         if($this->codeSupplier != null && $this->codeProducer != null){
  19.             $result.= ' ('.$this->getCodeSupplier().' - '.$this->getCodeProducer().')';
  20.         }
  21.         else{
  22.             if($this->codeSupplier != null$result.= ' ('.$this->getCodeSupplier().')';
  23.             if($this->codeProducer != null$result.= ' ('.$this->getCodeProducer().')';
  24.         }
  25.         return $result;
  26.     }
  27.     public function canDelete(){
  28.         if(sizeof($this->getRegeneratedProducts()) > 0) return false;
  29.         if(sizeof($this->getWithdrawActivities()) > 0) return false;
  30.         if(sizeof($this->getActualActivities()) > 0) return false;
  31.         if(sizeof($this->getInstallationActivities()) > 0) return false;
  32.         if(sizeof($this->getProducts()) > 0) return false;
  33.         return true;
  34.     }
  35.     
  36.     public function canBeTransferredStatus($transfer){
  37.         switch($transfer->getType()){
  38.             case 'technician':
  39.                 if($this->getStatus()->getSlug() != "available")
  40.                     return 'Il prodotto non è nello stato Disponibile';
  41.                 break;
  42.             case 'main':
  43.                 if($this->getStatus()->getSlug() == "transfer")
  44.                     return 'Il prodotto è già in trasferimento';
  45.                 break;
  46.             case 'destination':
  47.                 if($this->getStatus()->getSlug() == "transfer")
  48.                     return 'Il prodotto è già in trasferimento';
  49.                 if($transfer->getSupplier() != null && !$this->hasSupplier($transfer->getSupplier()))
  50.                     return "Il prodotto non può essere utilizzato per il fornitore ".$transfer->getSupplier();
  51.                 break;
  52.             default: break;
  53.         }
  54.         return "ok";
  55.     }
  56.     
  57.     public function getIsAlreadyInserted($type){
  58.         if(sizeof($this->getTransfers()) > 0) return false;
  59.         if($type == "withdraw" && sizeof($this->getWithdrawActivities()) > 1) return false;
  60.         if($type != "withdraw" && sizeof($this->getWithdrawActivities()) > 0) return false;
  61.         if($type == "actual" && sizeof($this->getActualActivities()) > 1) return false;
  62.         if($type != "actual" && sizeof($this->getActualActivities()) > 0) return false;
  63.         if(sizeof($this->getInstallationActivities()) > 0) return false;
  64.         if(sizeof($this->getProducts()) > 0) return false;
  65.         return true;
  66.     }
  67.     public function getDisplayConflict(){
  68.         $string "<strong>Modello</strong>: ".$this->getModel()->getName()."<br>";
  69.         $string.= "<strong>Matricola produttore</strong>: ".$this->getCodeProducer()."<br>";
  70.         $string.= "<strong>Matricola fornitore</strong>: ".$this->getCodeSupplier()."<br>";
  71.         return $string;
  72.     }
  73.     public function displayActive(){
  74.         if($this->active){
  75.             $color 'color_gr';
  76.             $title 'Attivo';
  77.         }
  78.         else{
  79.             $color 'color_r';
  80.             $title 'Sospeso';
  81.         }
  82.         return '<i class="icon-circle cursor_p '.$color.'" data-bs-toggle="tooltip" title="'.$title.'"></i>';
  83.     }
  84.     public function displayStatus($type){
  85.         switch($this->getStatus()->getSlug()){
  86.             case 'available'$color 'color_gr'; break;
  87.             case 'transfer'$color 'color_am'; break;
  88.             case 'in_use'$color 'color_r'; break;
  89.             case 'not_available'$color 'color_am'; break;
  90.             default: break;
  91.         }
  92.         
  93.         switch($type){
  94.             case 'icon'$string '<i class="icon-circle cursor_p '.$color.'" data-bs-toggle="tooltip" title="'.$this->getStatus()->getValue().'"></i>'; break;
  95.             case 'string'$string $this->getStatus()->getValue(); break;
  96.             default: break;
  97.         }
  98.         return $string;
  99.     }
  100.     
  101.     public function displayCondition($type){
  102.         $string '';
  103.         switch($this->getCondition()->getSlug()){
  104.             case 'new'
  105.             case 'refurbished':
  106.             case 'repaired':
  107.             case 'free':
  108.             case 'regenerated':
  109.                 $color 'color_gr';
  110.                 break;
  111.             case 'retired':
  112.             case 'historic':
  113.                 $color 'color_am';
  114.                 break;
  115.             case 'broken':
  116.             case 'doa':
  117.             case 'lost':
  118.                 $color 'color_r';
  119.                 break;
  120.             default: break;
  121.         }
  122.         switch($type){
  123.             case 'icon'$string '<i class="icon-circle cursor_p '.$color.'" data-bs-toggle="tooltip" title="'.$this->getCondition()->getValue().'"></i>'; break;
  124.             case 'string'$string $this->getCondition()->getValue(); break;
  125.             case 'string-short'$str explode('-'$this->getCondition()->getValue()); $string $str[0]; break;
  126.             default: break;
  127.         }
  128.         return $string;
  129.     }
  130.     public function displayCodes(){
  131.         $result '';
  132.         if($this->codeSupplier != null)
  133.             $result.= 'Matricola fornitore: '.$this->getCodeSupplier();
  134.         if($this->codeProducer != null){
  135.             if($result != ''$result.= ' --- ';
  136.             $result.= 'Matricola produttore: '.$this->getCodeProducer();
  137.         }
  138.         return $result;
  139.     }
  140.         
  141.     public function displayChildrenProducts($type){
  142.         $result '';
  143.         if((sizeof($this->products) > 0)){
  144.             switch($type){
  145.                 case 'table':
  146.                     $result .= '<table class="table table_no_padding b_none m_b_none"><thead><tr><th>Prodotto</th><th>Matr. Prod.</th><th>Matr. Forn.</th></thead>';
  147.                     foreach($this->products as $product){
  148.                         $result .= '<tr><td>'.$product->getModel()->getName().'</td><td>'.$product->getCodeProducer().'</td><td>'.$product->getCodeSupplier().'</td></tr>';
  149.                     }
  150.                     $result.= '</table>';
  151.                     break;
  152.                 case 'string':
  153.                     $first true;
  154.                     foreach($this->products as $product){
  155.                         if($first$first false; else $result.= ' - ';
  156.                         $result .= $product->getModel()->getName();
  157.                     }
  158.                 default: break;
  159.             }            
  160.         }
  161.         return $result;
  162.     }
  163.     
  164.     public function displaySuppliers(){
  165.         $result '---';
  166.         if(sizeof($this->suppliers) > 0){
  167.             $result '<table class="table table_no_padding m_b_none b_none">';
  168.             foreach($this->suppliers as $supplier){
  169.                 $result .= '<tr><td>'.$supplier->getName().'</td></tr>';
  170.             }
  171.             $result.= '</table>';
  172.         }
  173.         return $result;
  174.     }
  175.     
  176.     public function displayStringSuppliers(){
  177.         $result '';
  178.         if(sizeof($this->suppliers) > 0){
  179.             $first true;
  180.             foreach($this->suppliers as $supplier){
  181.                 if($first$first false; else $result.= ', ';
  182.                 $result .= $supplier->getName();
  183.             }
  184.         }
  185.         return $result;
  186.     }
  187.     public function displayTransfersDdts(){
  188.         $result '---';
  189.         if(sizeof($this->transfers) > 0){
  190.             $result '';
  191.             $first true;
  192.             foreach($this->transfers as $jtppt){
  193.                 if($first$first false; else $result.= ', ';
  194.                 $result .= $jtppt->getTransfer()->getDdt();
  195.             }
  196.         }
  197.         return $result;
  198.     }
  199.     
  200.     public function displayLastRefs(){
  201.         $string "";
  202.         if($this->getLastTicket() != null){
  203.             $string.="<br>";
  204.             $string.="Ticket: <u>".$this->getLastTicket()->getNumber()."</u><br>";
  205.             $string.="Operazione: ".$this->getLastOperationGroupType()."<br>";
  206.             $string.="Termid: ".$this->getLastTicket()->getTermid()->getCode();
  207.             $string.="";
  208.         }
  209.         return $string;
  210.     }
  211.     
  212.     public function displayTransfersDdt(){
  213.         $first true;
  214.         $string '';
  215.         if(sizeof($this->getTransfers()) > 3){
  216.             $tooltip '';
  217.             foreach($this->getTransfers() as $jt){
  218.                 if($first$first false; else $tooltip.= ' - ';
  219.                 $tooltip.= $jt->getTransfer()->getDdt();
  220.             }
  221.             $string '<a href="javascript:void(0)" data-bs-toggle="tooltip" data-bs-title="'.$tooltip.'">'.$this->getTransfers()[0]->getTransfer()->getDdt().' - '.$this->getTransfers()[1]->getTransfer()->getDdt().' - '.$this->getTransfers()[2]->getTransfer()->getDdt().' ...</a>';
  222.         }
  223.         else{
  224.             foreach($this->getTransfers() as $jt){
  225.                 if($first$first false; else $string.= ' - ';
  226.                 $string.= $jt->getTransfer()->getDdt();
  227.             }
  228.         }
  229.         return $string;
  230.     }
  231.     
  232.     public function getLastLogWithIntervention(){
  233.         $lastLog null;
  234.         $dateLastLog date_create_from_format('d-m-Y H:i''01-01-2000 00:00');
  235.         foreach($this->logs as $log){
  236.             if($log->getIntervention() != null && $log->getDatetime()->format('YmdHis') > $dateLastLog->format('YmdHis')){
  237.                 $dateLastLog $log->getDatetime();
  238.                 $lastLog $log;
  239.             }
  240.         }
  241.         return $lastLog;
  242.     }
  243.     public function getLastTransfer(){
  244.         $transfer null;
  245.         $dateLastTransfer date_create_from_format('d-m-Y H:i''01-01-2000 00:00');
  246.         foreach($this->transfers as $jt){
  247.             if($jt->getTransfer()->getDatetimeCreation()->format('YmdHi') > $dateLastTransfer->format('YmdHi')){
  248.                 $dateLastTransfer $jt->getTransfer()->getDatetimeCreation();
  249.                 $transfer $jt->getTransfer();
  250.             }
  251.         }
  252.         return $transfer;
  253.     }
  254.     public function getLastTransferFromClient(){
  255.         $transfer null;
  256.         $dateLastTransfer date_create_from_format('d-m-Y H:i''01-01-2000 00:00');
  257.         foreach($this->transfers as $jt){
  258.             if($jt->getTransfer()->getWarehouseFrom()->getClient() != null && $jt->getTransfer()->getDatetimeCreation()->format('YmdHi') > $dateLastTransfer->format('YmdHi')){
  259.                 $dateLastTransfer $jt->getTransfer()->getDatetimeCreation();
  260.                 $transfer $jt->getTransfer();
  261.             }
  262.         }
  263.         return $transfer;
  264.     }
  265.     public function getLastOperationGroupType() {
  266.         return $this->getLastTicket()->getOperation()->getGroup()->getValue();
  267.     }
  268.     public function getLastTicket() {
  269.         $ticket null;
  270.         $log $this->getLastLogWithIntervention();
  271.         if($log != null)
  272.             $ticket $log->getIntervention()->getTicket();
  273.         return $ticket;
  274.     }
  275.     public function hasSupplier($supplier){
  276.         foreach($this->getSuppliers() as $sup){
  277.             if($sup->getId() == $supplier->getId())
  278.                 return true;
  279.         }
  280.         return false;
  281.     }
  282.     public function movedByDS(){
  283.         switch($this->getModel()->getId()){
  284.             case 141:
  285.             case 142:
  286.             case 143:
  287.             case 144:
  288.             case 145:
  289.             case 146:
  290.             case 147:
  291.                 return true;
  292.             default:
  293.                 return false;
  294.         }
  295.         return false;
  296.     }
  297.     public function getLastUserLog(){
  298.         $logs $this->getLogs()->toArray();
  299.         if(empty($logs)) return null;
  300.         usort($logs, function ($a$b) { return $b->getDatetime() <=> $a->getDatetime(); });
  301.         return $logs[0]->getOperator() ?? null;
  302.     }
  303.     /**
  304.      * @ORM\Column(name="id", type="bigint")
  305.      * @ORM\Id
  306.      * @ORM\GeneratedValue(strategy="AUTO")
  307.      */
  308.     protected $id;
  309.     
  310.     /**
  311.      * @ORM\Column(name="code_producer", type="string", length=191, nullable=true)
  312.      */
  313.     protected $codeProducer;
  314.     /**
  315.      * @ORM\Column(name="code_supplier", type="string", length=191, nullable=true)
  316.      */
  317.     protected $codeSupplier;
  318.     /**
  319.      * @ORM\Column(name="date_creation", type="datetime", nullable=true)
  320.      */
  321.     protected $dateCreation;
  322.     /**
  323.      * @ORM\Column(name="date_last_transfer", type="datetime", nullable=true)
  324.      */
  325.     protected $dateLastTransfer;
  326.             
  327.     /**
  328.      * @ORM\Column(name="is_active", type="boolean")
  329.      */
  330.     protected $active true;
  331.     /**
  332.      * @ORM\Column(name="to_manage", type="boolean")
  333.      */
  334.     protected $toManage false;
  335.     /**
  336.      * @ORM\Column(name="to_manage_priority", type="integer")
  337.      */
  338.     protected $toManagePriority 2;
  339.         
  340.     // ManyToOne
  341.         /**
  342.          * @ORM\ManyToOne(targetEntity="App\Entity\Slave\ProductModel", inversedBy="products")
  343.          * @ORM\JoinColumn(name="model_id", referencedColumnName="id")
  344.          */
  345.         private $model;
  346.         /**
  347.          * @ORM\ManyToOne(targetEntity="App\Entity\Slave\Warehouse", inversedBy="products")
  348.          * @ORM\JoinColumn(name="actual_warehouse_id", referencedColumnName="id")
  349.          */
  350.         private $actualWarehouse;
  351.         /**
  352.          * @ORM\ManyToOne(targetEntity="App\Entity\Slave\ProductStatus", inversedBy="products")
  353.          * @ORM\JoinColumn(name="status_id", referencedColumnName="id")
  354.          */
  355.         private $status;
  356.         
  357.         /**
  358.          * @ORM\ManyToOne(targetEntity="App\Entity\Slave\ProductCondition", inversedBy="products")
  359.          * @ORM\JoinColumn(name="condition_id", referencedColumnName="id")
  360.          */
  361.         private $condition;
  362.         /**
  363.          * @ORM\ManyToOne(targetEntity="App\Entity\Slave\Termid", inversedBy="products")
  364.          * @ORM\JoinColumn(name="termid_id", referencedColumnName="id")
  365.          */
  366.         private $termid;
  367.         
  368.         /**
  369.          * @ORM\ManyToOne(targetEntity="App\Entity\Slave\product", inversedBy="products")
  370.          * @ORM\JoinColumn(name="parent_product_id", referencedColumnName="id")
  371.          */
  372.         private $parentProduct;
  373.     //
  374.     // OneToMany
  375.         /**
  376.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\JoinTableProductProductTransfer", mappedBy="product")
  377.          */
  378.         private $transfers;
  379.         /**
  380.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\ProductTransferLog", mappedBy="product")
  381.          */
  382.         private $transferLogs;
  383.         
  384.         /**
  385.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\ProductLog", mappedBy="product")
  386.          */
  387.         private $logs;
  388.         /**
  389.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\ProductRegenerated", mappedBy="product")
  390.          */
  391.         private $regeneratedProducts;
  392.         /**
  393.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\InterventionActivity", mappedBy="productWithdraw")
  394.          */
  395.         private $withdrawActivities;
  396.         
  397.         /**
  398.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\InterventionActivity", mappedBy="productActual")
  399.          */
  400.         private $actualActivities;
  401.         
  402.         /**
  403.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\InterventionActivity", mappedBy="productInstallation")
  404.          */
  405.         private $installationActivities;
  406.         /**
  407.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\Product", mappedBy="parentProduct")
  408.          */
  409.         private $products;
  410.     //
  411.     // ManyToMany
  412.         /**
  413.          * @ORM\ManyToMany(targetEntity="App\Entity\Slave\Supplier", inversedBy="products")
  414.          * @ORM\JoinTable(name="eposm_s_join_table_product_supplier")
  415.          */
  416.         private $suppliers;
  417.         public function __construct()
  418.         {
  419.             $this->transfers = new ArrayCollection();
  420.             $this->transferLogs = new ArrayCollection();
  421.             $this->logs = new ArrayCollection();
  422.             $this->regenerates = new ArrayCollection();
  423.             $this->withdrawActivities = new ArrayCollection();
  424.             $this->actualActivities = new ArrayCollection();
  425.             $this->installationActivities = new ArrayCollection();
  426.             $this->products = new ArrayCollection();
  427.             $this->suppliers = new ArrayCollection();
  428.             $this->regeneratedProducts = new ArrayCollection();
  429.         }
  430.         public function getId(): ?string
  431.         {
  432.             return $this->id;
  433.         }
  434.         public function getCodeProducer(): ?string
  435.         {
  436.             return $this->codeProducer;
  437.         }
  438.         public function setCodeProducer(?string $codeProducer): static
  439.         {
  440.             $this->codeProducer $codeProducer;
  441.             return $this;
  442.         }
  443.         public function getCodeSupplier(): ?string
  444.         {
  445.             return $this->codeSupplier;
  446.         }
  447.         public function setCodeSupplier(?string $codeSupplier): static
  448.         {
  449.             $this->codeSupplier $codeSupplier;
  450.             return $this;
  451.         }
  452.         public function getDateLastTransfer(): ?\DateTimeInterface
  453.         {
  454.             return $this->dateLastTransfer;
  455.         }
  456.         public function setDateLastTransfer(?\DateTimeInterface $dateLastTransfer): static
  457.         {
  458.             $this->dateLastTransfer $dateLastTransfer;
  459.             return $this;
  460.         }
  461.         public function isActive(): ?bool
  462.         {
  463.             return $this->active;
  464.         }
  465.         public function setActive(bool $active): static
  466.         {
  467.             $this->active $active;
  468.             return $this;
  469.         }
  470.         public function isToManage(): ?bool
  471.         {
  472.             return $this->toManage;
  473.         }
  474.         public function setToManage(bool $toManage): static
  475.         {
  476.             $this->toManage $toManage;
  477.             return $this;
  478.         }
  479.         public function getToManagePriority(): ?int
  480.         {
  481.             return $this->toManagePriority;
  482.         }
  483.         public function setToManagePriority(int $toManagePriority): static
  484.         {
  485.             $this->toManagePriority $toManagePriority;
  486.             return $this;
  487.         }
  488.         public function getModel(): ?ProductModel
  489.         {
  490.             return $this->model;
  491.         }
  492.         public function setModel(?ProductModel $model): static
  493.         {
  494.             $this->model $model;
  495.             return $this;
  496.         }
  497.         public function getActualWarehouse(): ?Warehouse
  498.         {
  499.             return $this->actualWarehouse;
  500.         }
  501.         public function setActualWarehouse(?Warehouse $actualWarehouse): static
  502.         {
  503.             $this->actualWarehouse $actualWarehouse;
  504.             return $this;
  505.         }
  506.         public function getStatus(): ?ProductStatus
  507.         {
  508.             return $this->status;
  509.         }
  510.         public function setStatus(?ProductStatus $status): static
  511.         {
  512.             $this->status $status;
  513.             return $this;
  514.         }
  515.         public function getCondition(): ?ProductCondition
  516.         {
  517.             return $this->condition;
  518.         }
  519.         public function setCondition(?ProductCondition $condition): static
  520.         {
  521.             $this->condition $condition;
  522.             return $this;
  523.         }
  524.         public function getTermid(): ?Termid
  525.         {
  526.             return $this->termid;
  527.         }
  528.         public function setTermid(?Termid $termid): static
  529.         {
  530.             $this->termid $termid;
  531.             return $this;
  532.         }
  533.         public function getParentProduct(): ?product
  534.         {
  535.             return $this->parentProduct;
  536.         }
  537.         public function setParentProduct(?product $parentProduct): static
  538.         {
  539.             $this->parentProduct $parentProduct;
  540.             return $this;
  541.         }
  542.         /**
  543.          * @return Collection<int, JoinTableProductProductTransfer>
  544.          */
  545.         public function getTransfers(): Collection
  546.         {
  547.             return $this->transfers;
  548.         }
  549.         public function addTransfer(JoinTableProductProductTransfer $transfer): static
  550.         {
  551.             if (!$this->transfers->contains($transfer)) {
  552.                 $this->transfers->add($transfer);
  553.                 $transfer->setProduct($this);
  554.             }
  555.             return $this;
  556.         }
  557.         public function removeTransfer(JoinTableProductProductTransfer $transfer): static
  558.         {
  559.             if ($this->transfers->removeElement($transfer)) {
  560.                 // set the owning side to null (unless already changed)
  561.                 if ($transfer->getProduct() === $this) {
  562.                     $transfer->setProduct(null);
  563.                 }
  564.             }
  565.             return $this;
  566.         }
  567.         /**
  568.          * @return Collection<int, ProductTransferLog>
  569.          */
  570.         public function getTransferLogs(): Collection
  571.         {
  572.             return $this->transferLogs;
  573.         }
  574.         public function addTransferLog(ProductTransferLog $transferLog): static
  575.         {
  576.             if (!$this->transferLogs->contains($transferLog)) {
  577.                 $this->transferLogs->add($transferLog);
  578.                 $transferLog->setProduct($this);
  579.             }
  580.             return $this;
  581.         }
  582.         public function removeTransferLog(ProductTransferLog $transferLog): static
  583.         {
  584.             if ($this->transferLogs->removeElement($transferLog)) {
  585.                 // set the owning side to null (unless already changed)
  586.                 if ($transferLog->getProduct() === $this) {
  587.                     $transferLog->setProduct(null);
  588.                 }
  589.             }
  590.             return $this;
  591.         }
  592.         /**
  593.          * @return Collection<int, ProductLog>
  594.          */
  595.         public function getLogs(): Collection
  596.         {
  597.             return $this->logs;
  598.         }
  599.         public function addLog(ProductLog $log): static
  600.         {
  601.             if (!$this->logs->contains($log)) {
  602.                 $this->logs->add($log);
  603.                 $log->setProduct($this);
  604.             }
  605.             return $this;
  606.         }
  607.         public function removeLog(ProductLog $log): static
  608.         {
  609.             if ($this->logs->removeElement($log)) {
  610.                 // set the owning side to null (unless already changed)
  611.                 if ($log->getProduct() === $this) {
  612.                     $log->setProduct(null);
  613.                 }
  614.             }
  615.             return $this;
  616.         }
  617.         /**
  618.          * @return Collection<int, InterventionActivity>
  619.          */
  620.         public function getWithdrawActivities(): Collection
  621.         {
  622.             return $this->withdrawActivities;
  623.         }
  624.         public function addWithdrawActivity(InterventionActivity $withdrawActivity): static
  625.         {
  626.             if (!$this->withdrawActivities->contains($withdrawActivity)) {
  627.                 $this->withdrawActivities->add($withdrawActivity);
  628.                 $withdrawActivity->setProductWithdraw($this);
  629.             }
  630.             return $this;
  631.         }
  632.         public function removeWithdrawActivity(InterventionActivity $withdrawActivity): static
  633.         {
  634.             if ($this->withdrawActivities->removeElement($withdrawActivity)) {
  635.                 // set the owning side to null (unless already changed)
  636.                 if ($withdrawActivity->getProductWithdraw() === $this) {
  637.                     $withdrawActivity->setProductWithdraw(null);
  638.                 }
  639.             }
  640.             return $this;
  641.         }
  642.         /**
  643.          * @return Collection<int, InterventionActivity>
  644.          */
  645.         public function getActualActivities(): Collection
  646.         {
  647.             return $this->actualActivities;
  648.         }
  649.         public function addActualActivity(InterventionActivity $actualActivity): static
  650.         {
  651.             if (!$this->actualActivities->contains($actualActivity)) {
  652.                 $this->actualActivities->add($actualActivity);
  653.                 $actualActivity->setProductActual($this);
  654.             }
  655.             return $this;
  656.         }
  657.         public function removeActualActivity(InterventionActivity $actualActivity): static
  658.         {
  659.             if ($this->actualActivities->removeElement($actualActivity)) {
  660.                 // set the owning side to null (unless already changed)
  661.                 if ($actualActivity->getProductActual() === $this) {
  662.                     $actualActivity->setProductActual(null);
  663.                 }
  664.             }
  665.             return $this;
  666.         }
  667.         /**
  668.          * @return Collection<int, InterventionActivity>
  669.          */
  670.         public function getInstallationActivities(): Collection
  671.         {
  672.             return $this->installationActivities;
  673.         }
  674.         public function addInstallationActivity(InterventionActivity $installationActivity): static
  675.         {
  676.             if (!$this->installationActivities->contains($installationActivity)) {
  677.                 $this->installationActivities->add($installationActivity);
  678.                 $installationActivity->setProductInstallation($this);
  679.             }
  680.             return $this;
  681.         }
  682.         public function removeInstallationActivity(InterventionActivity $installationActivity): static
  683.         {
  684.             if ($this->installationActivities->removeElement($installationActivity)) {
  685.                 // set the owning side to null (unless already changed)
  686.                 if ($installationActivity->getProductInstallation() === $this) {
  687.                     $installationActivity->setProductInstallation(null);
  688.                 }
  689.             }
  690.             return $this;
  691.         }
  692.         /**
  693.          * @return Collection<int, Product>
  694.          */
  695.         public function getProducts(): Collection
  696.         {
  697.             return $this->products;
  698.         }
  699.         public function addProduct(Product $product): static
  700.         {
  701.             if (!$this->products->contains($product)) {
  702.                 $this->products->add($product);
  703.                 $product->setParentProduct($this);
  704.             }
  705.             return $this;
  706.         }
  707.         public function removeProduct(Product $product): static
  708.         {
  709.             if ($this->products->removeElement($product)) {
  710.                 // set the owning side to null (unless already changed)
  711.                 if ($product->getParentProduct() === $this) {
  712.                     $product->setParentProduct(null);
  713.                 }
  714.             }
  715.             return $this;
  716.         }
  717.         /**
  718.          * @return Collection<int, Supplier>
  719.          */
  720.         public function getSuppliers(): Collection
  721.         {
  722.             return $this->suppliers;
  723.         }
  724.         public function addSupplier(Supplier $supplier): static
  725.         {
  726.             if (!$this->suppliers->contains($supplier)) {
  727.                 $this->suppliers->add($supplier);
  728.             }
  729.             return $this;
  730.         }
  731.         public function removeSupplier(Supplier $supplier): static
  732.         {
  733.             $this->suppliers->removeElement($supplier);
  734.             return $this;
  735.         }
  736.     public function getDateCreation(): ?\DateTimeInterface
  737.     {
  738.         return $this->dateCreation;
  739.     }
  740.     public function setDateCreation(?\DateTimeInterface $dateCreation): static
  741.     {
  742.         $this->dateCreation $dateCreation;
  743.         return $this;
  744.     }
  745.     /**
  746.      * @return Collection<int, ProductRegenerated>
  747.      */
  748.     public function getRegeneratedProducts(): Collection
  749.     {
  750.         return $this->regeneratedProducts;
  751.     }
  752.     public function addRegeneratedProduct(ProductRegenerated $regeneratedProduct): static
  753.     {
  754.         if (!$this->regeneratedProducts->contains($regeneratedProduct)) {
  755.             $this->regeneratedProducts->add($regeneratedProduct);
  756.             $regeneratedProduct->setProduct($this);
  757.         }
  758.         return $this;
  759.     }
  760.     public function removeRegeneratedProduct(ProductRegenerated $regeneratedProduct): static
  761.     {
  762.         if ($this->regeneratedProducts->removeElement($regeneratedProduct)) {
  763.             // set the owning side to null (unless already changed)
  764.             if ($regeneratedProduct->getProduct() === $this) {
  765.                 $regeneratedProduct->setProduct(null);
  766.             }
  767.         }
  768.         return $this;
  769.     }
  770. }