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 displayLastRefs(){
  188.         $string "";
  189.         if($this->getLastTicket() != null){
  190.             $string.="<br>";
  191.             $string.="Ticket: <u>".$this->getLastTicket()->getNumber()."</u><br>";
  192.             $string.="Operazione: ".$this->getLastOperationGroupType()."<br>";
  193.             $string.="Termid: ".$this->getLastTicket()->getTermid()->getCode();
  194.             $string.="";
  195.         }
  196.         return $string;
  197.     }
  198.     
  199.     public function displayTransfersDdt(){
  200.         $first true;
  201.         $string '';
  202.         if(sizeof($this->getTransfers()) > 3){
  203.             $tooltip '';
  204.             foreach($this->getTransfers() as $jt){
  205.                 if($first$first false; else $tooltip.= ' - ';
  206.                 $tooltip.= $jt->getTransfer()->getDdt();
  207.             }
  208.             $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>';
  209.         }
  210.         else{
  211.             foreach($this->getTransfers() as $jt){
  212.                 if($first$first false; else $string.= ' - ';
  213.                 $string.= $jt->getTransfer()->getDdt();
  214.             }
  215.         }
  216.         return $string;
  217.     }
  218.     
  219.     public function getLastLogWithIntervention(){
  220.         $lastLog null;
  221.         $dateLastLog date_create_from_format('d-m-Y H:i''01-01-2000 00:00');
  222.         foreach($this->logs as $log){
  223.             if($log->getIntervention() != null && $log->getDatetime()->format('YmdHis') > $dateLastLog->format('YmdHis')){
  224.                 $dateLastLog $log->getDatetime();
  225.                 $lastLog $log;
  226.             }
  227.         }
  228.         return $lastLog;
  229.     }
  230.     public function getLastTransfer(){
  231.         $transfer null;
  232.         $dateLastTransfer date_create_from_format('d-m-Y H:i''01-01-2000 00:00');
  233.         foreach($this->transfers as $jt){
  234.             if($jt->getTransfer()->getDatetimeCreation()->format('YmdHi') > $dateLastTransfer->format('YmdHi')){
  235.                 $dateLastTransfer $jt->getTransfer()->getDatetimeCreation();
  236.                 $transfer $jt->getTransfer();
  237.             }
  238.         }
  239.         return $transfer;
  240.     }
  241.     public function getLastTransferFromClient(){
  242.         $transfer null;
  243.         $dateLastTransfer date_create_from_format('d-m-Y H:i''01-01-2000 00:00');
  244.         foreach($this->transfers as $jt){
  245.             if($jt->getTransfer()->getWarehouseFrom()->getClient() != null && $jt->getTransfer()->getDatetimeCreation()->format('YmdHi') > $dateLastTransfer->format('YmdHi')){
  246.                 $dateLastTransfer $jt->getTransfer()->getDatetimeCreation();
  247.                 $transfer $jt->getTransfer();
  248.             }
  249.         }
  250.         return $transfer;
  251.     }
  252.     public function getLastOperationGroupType() {
  253.         return $this->getLastTicket()->getOperation()->getGroup()->getValue();
  254.     }
  255.     public function getLastTicket() {
  256.         $ticket null;
  257.         $log $this->getLastLogWithIntervention();
  258.         if($log != null)
  259.             $ticket $log->getIntervention()->getTicket();
  260.         return $ticket;
  261.     }
  262.     public function hasSupplier($supplier){
  263.         foreach($this->getSuppliers() as $sup){
  264.             if($sup->getId() == $supplier->getId())
  265.                 return true;
  266.         }
  267.         return false;
  268.     }
  269.     public function movedByDS(){
  270.         switch($this->getModel()->getId()){
  271.             case 141:
  272.             case 142:
  273.             case 143:
  274.             case 144:
  275.             case 145:
  276.             case 146:
  277.             case 147:
  278.                 return true;
  279.             default:
  280.                 return false;
  281.         }
  282.         return false;
  283.     }
  284.     /**
  285.      * @ORM\Column(name="id", type="bigint")
  286.      * @ORM\Id
  287.      * @ORM\GeneratedValue(strategy="AUTO")
  288.      */
  289.     protected $id;
  290.     
  291.     /**
  292.      * @ORM\Column(name="code_producer", type="string", length=191, nullable=true)
  293.      */
  294.     protected $codeProducer;
  295.     /**
  296.      * @ORM\Column(name="code_supplier", type="string", length=191, nullable=true)
  297.      */
  298.     protected $codeSupplier;
  299.     /**
  300.      * @ORM\Column(name="date_creation", type="datetime", nullable=true)
  301.      */
  302.     protected $dateCreation;
  303.     /**
  304.      * @ORM\Column(name="date_last_transfer", type="datetime", nullable=true)
  305.      */
  306.     protected $dateLastTransfer;
  307.             
  308.     /**
  309.      * @ORM\Column(name="is_active", type="boolean")
  310.      */
  311.     protected $active true;
  312.     /**
  313.      * @ORM\Column(name="to_manage", type="boolean")
  314.      */
  315.     protected $toManage false;
  316.     /**
  317.      * @ORM\Column(name="to_manage_priority", type="integer")
  318.      */
  319.     protected $toManagePriority 2;
  320.         
  321.     // ManyToOne
  322.         /**
  323.          * @ORM\ManyToOne(targetEntity="App\Entity\Slave\ProductModel", inversedBy="products")
  324.          * @ORM\JoinColumn(name="model_id", referencedColumnName="id")
  325.          */
  326.         private $model;
  327.         /**
  328.          * @ORM\ManyToOne(targetEntity="App\Entity\Slave\Warehouse", inversedBy="products")
  329.          * @ORM\JoinColumn(name="actual_warehouse_id", referencedColumnName="id")
  330.          */
  331.         private $actualWarehouse;
  332.         /**
  333.          * @ORM\ManyToOne(targetEntity="App\Entity\Slave\ProductStatus", inversedBy="products")
  334.          * @ORM\JoinColumn(name="status_id", referencedColumnName="id")
  335.          */
  336.         private $status;
  337.         
  338.         /**
  339.          * @ORM\ManyToOne(targetEntity="App\Entity\Slave\ProductCondition", inversedBy="products")
  340.          * @ORM\JoinColumn(name="condition_id", referencedColumnName="id")
  341.          */
  342.         private $condition;
  343.         /**
  344.          * @ORM\ManyToOne(targetEntity="App\Entity\Slave\Termid", inversedBy="products")
  345.          * @ORM\JoinColumn(name="termid_id", referencedColumnName="id")
  346.          */
  347.         private $termid;
  348.         
  349.         /**
  350.          * @ORM\ManyToOne(targetEntity="App\Entity\Slave\product", inversedBy="products")
  351.          * @ORM\JoinColumn(name="parent_product_id", referencedColumnName="id")
  352.          */
  353.         private $parentProduct;
  354.     //
  355.     // OneToMany
  356.         /**
  357.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\JoinTableProductProductTransfer", mappedBy="product")
  358.          */
  359.         private $transfers;
  360.         /**
  361.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\ProductTransferLog", mappedBy="product")
  362.          */
  363.         private $transferLogs;
  364.         
  365.         /**
  366.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\ProductLog", mappedBy="product")
  367.          */
  368.         private $logs;
  369.         /**
  370.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\ProductRegenerated", mappedBy="product")
  371.          */
  372.         private $regeneratedProducts;
  373.         /**
  374.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\InterventionActivity", mappedBy="productWithdraw")
  375.          */
  376.         private $withdrawActivities;
  377.         
  378.         /**
  379.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\InterventionActivity", mappedBy="productActual")
  380.          */
  381.         private $actualActivities;
  382.         
  383.         /**
  384.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\InterventionActivity", mappedBy="productInstallation")
  385.          */
  386.         private $installationActivities;
  387.         /**
  388.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\Product", mappedBy="parentProduct")
  389.          */
  390.         private $products;
  391.     //
  392.     // ManyToMany
  393.         /**
  394.          * @ORM\ManyToMany(targetEntity="App\Entity\Slave\Supplier", inversedBy="products")
  395.          * @ORM\JoinTable(name="eposm_s_join_table_product_supplier")
  396.          */
  397.         private $suppliers;
  398.         public function __construct()
  399.         {
  400.             $this->transfers = new ArrayCollection();
  401.             $this->transferLogs = new ArrayCollection();
  402.             $this->logs = new ArrayCollection();
  403.             $this->regenerates = new ArrayCollection();
  404.             $this->withdrawActivities = new ArrayCollection();
  405.             $this->actualActivities = new ArrayCollection();
  406.             $this->installationActivities = new ArrayCollection();
  407.             $this->products = new ArrayCollection();
  408.             $this->suppliers = new ArrayCollection();
  409.             $this->regeneratedProducts = new ArrayCollection();
  410.         }
  411.     //
  412.     public function getId(): ?string
  413.     {
  414.         return $this->id;
  415.     }
  416.     public function getCodeProducer(): ?string
  417.     {
  418.         return strtoupper($this->codeProducer);
  419.     }
  420.     public function setCodeProducer(?string $codeProducer): static
  421.     {
  422.         $this->codeProducer strtoupper($codeProducer);
  423.         return $this;
  424.     }
  425.     public function getCodeSupplier(): ?string
  426.     {
  427.         return strtoupper($this->codeSupplier);
  428.     }
  429.     public function setCodeSupplier(?string $codeSupplier): static
  430.     {
  431.         $this->codeSupplier strtoupper($codeSupplier);
  432.         return $this;
  433.     }
  434.     public function getDateLastTransfer(): ?\DateTimeInterface
  435.     {
  436.         return $this->dateLastTransfer;
  437.     }
  438.     public function setDateLastTransfer(?\DateTimeInterface $dateLastTransfer): static
  439.     {
  440.         $this->dateLastTransfer $dateLastTransfer;
  441.         return $this;
  442.     }
  443.     public function isActive(): ?bool
  444.     {
  445.         return $this->active;
  446.     }
  447.     public function setActive(bool $active): static
  448.     {
  449.         $this->active $active;
  450.         return $this;
  451.     }
  452.     public function isToManage(): ?bool
  453.     {
  454.         return $this->toManage;
  455.     }
  456.     public function setToManage(bool $toManage): static
  457.     {
  458.         $this->toManage $toManage;
  459.         return $this;
  460.     }
  461.     public function getToManagePriority(): ?int
  462.     {
  463.         return $this->toManagePriority;
  464.     }
  465.     public function setToManagePriority(int $toManagePriority): static
  466.     {
  467.         $this->toManagePriority $toManagePriority;
  468.         return $this;
  469.     }
  470.     public function getModel(): ?ProductModel
  471.     {
  472.         return $this->model;
  473.     }
  474.     public function setModel(?ProductModel $model): static
  475.     {
  476.         $this->model $model;
  477.         return $this;
  478.     }
  479.     public function getActualWarehouse(): ?Warehouse
  480.     {
  481.         return $this->actualWarehouse;
  482.     }
  483.     public function setActualWarehouse(?Warehouse $actualWarehouse): static
  484.     {
  485.         $this->actualWarehouse $actualWarehouse;
  486.         return $this;
  487.     }
  488.     public function getStatus(): ?ProductStatus
  489.     {
  490.         return $this->status;
  491.     }
  492.     public function setStatus(?ProductStatus $status): static
  493.     {
  494.         $this->status $status;
  495.         return $this;
  496.     }
  497.     public function getCondition(): ?ProductCondition
  498.     {
  499.         return $this->condition;
  500.     }
  501.     public function setCondition(?ProductCondition $condition): static
  502.     {
  503.         $this->condition $condition;
  504.         return $this;
  505.     }
  506.     public function getTermid(): ?Termid
  507.     {
  508.         return $this->termid;
  509.     }
  510.     public function setTermid(?Termid $termid): static
  511.     {
  512.         $this->termid $termid;
  513.         return $this;
  514.     }
  515.     public function getParentProduct(): ?product
  516.     {
  517.         return $this->parentProduct;
  518.     }
  519.     public function setParentProduct(?product $parentProduct): static
  520.     {
  521.         $this->parentProduct $parentProduct;
  522.         return $this;
  523.     }
  524.     /**
  525.      * @return Collection<int, JoinTableProductProductTransfer>
  526.      */
  527.     public function getTransfers(): Collection
  528.     {
  529.         return $this->transfers;
  530.     }
  531.     public function addTransfer(JoinTableProductProductTransfer $transfer): static
  532.     {
  533.         if (!$this->transfers->contains($transfer)) {
  534.             $this->transfers->add($transfer);
  535.             $transfer->setProduct($this);
  536.         }
  537.         return $this;
  538.     }
  539.     public function removeTransfer(JoinTableProductProductTransfer $transfer): static
  540.     {
  541.         if ($this->transfers->removeElement($transfer)) {
  542.             // set the owning side to null (unless already changed)
  543.             if ($transfer->getProduct() === $this) {
  544.                 $transfer->setProduct(null);
  545.             }
  546.         }
  547.         return $this;
  548.     }
  549.     /**
  550.      * @return Collection<int, ProductTransferLog>
  551.      */
  552.     public function getTransferLogs(): Collection
  553.     {
  554.         return $this->transferLogs;
  555.     }
  556.     public function addTransferLog(ProductTransferLog $transferLog): static
  557.     {
  558.         if (!$this->transferLogs->contains($transferLog)) {
  559.             $this->transferLogs->add($transferLog);
  560.             $transferLog->setProduct($this);
  561.         }
  562.         return $this;
  563.     }
  564.     public function removeTransferLog(ProductTransferLog $transferLog): static
  565.     {
  566.         if ($this->transferLogs->removeElement($transferLog)) {
  567.             // set the owning side to null (unless already changed)
  568.             if ($transferLog->getProduct() === $this) {
  569.                 $transferLog->setProduct(null);
  570.             }
  571.         }
  572.         return $this;
  573.     }
  574.     /**
  575.      * @return Collection<int, ProductLog>
  576.      */
  577.     public function getLogs(): Collection
  578.     {
  579.         return $this->logs;
  580.     }
  581.     public function addLog(ProductLog $log): static
  582.     {
  583.         if (!$this->logs->contains($log)) {
  584.             $this->logs->add($log);
  585.             $log->setProduct($this);
  586.         }
  587.         return $this;
  588.     }
  589.     public function removeLog(ProductLog $log): static
  590.     {
  591.         if ($this->logs->removeElement($log)) {
  592.             // set the owning side to null (unless already changed)
  593.             if ($log->getProduct() === $this) {
  594.                 $log->setProduct(null);
  595.             }
  596.         }
  597.         return $this;
  598.     }
  599.     /**
  600.      * @return Collection<int, InterventionActivity>
  601.      */
  602.     public function getWithdrawActivities(): Collection
  603.     {
  604.         return $this->withdrawActivities;
  605.     }
  606.     public function addWithdrawActivity(InterventionActivity $withdrawActivity): static
  607.     {
  608.         if (!$this->withdrawActivities->contains($withdrawActivity)) {
  609.             $this->withdrawActivities->add($withdrawActivity);
  610.             $withdrawActivity->setProductWithdraw($this);
  611.         }
  612.         return $this;
  613.     }
  614.     public function removeWithdrawActivity(InterventionActivity $withdrawActivity): static
  615.     {
  616.         if ($this->withdrawActivities->removeElement($withdrawActivity)) {
  617.             // set the owning side to null (unless already changed)
  618.             if ($withdrawActivity->getProductWithdraw() === $this) {
  619.                 $withdrawActivity->setProductWithdraw(null);
  620.             }
  621.         }
  622.         return $this;
  623.     }
  624.     /**
  625.      * @return Collection<int, InterventionActivity>
  626.      */
  627.     public function getActualActivities(): Collection
  628.     {
  629.         return $this->actualActivities;
  630.     }
  631.     public function addActualActivity(InterventionActivity $actualActivity): static
  632.     {
  633.         if (!$this->actualActivities->contains($actualActivity)) {
  634.             $this->actualActivities->add($actualActivity);
  635.             $actualActivity->setProductActual($this);
  636.         }
  637.         return $this;
  638.     }
  639.     public function removeActualActivity(InterventionActivity $actualActivity): static
  640.     {
  641.         if ($this->actualActivities->removeElement($actualActivity)) {
  642.             // set the owning side to null (unless already changed)
  643.             if ($actualActivity->getProductActual() === $this) {
  644.                 $actualActivity->setProductActual(null);
  645.             }
  646.         }
  647.         return $this;
  648.     }
  649.     /**
  650.      * @return Collection<int, InterventionActivity>
  651.      */
  652.     public function getInstallationActivities(): Collection
  653.     {
  654.         return $this->installationActivities;
  655.     }
  656.     public function addInstallationActivity(InterventionActivity $installationActivity): static
  657.     {
  658.         if (!$this->installationActivities->contains($installationActivity)) {
  659.             $this->installationActivities->add($installationActivity);
  660.             $installationActivity->setProductInstallation($this);
  661.         }
  662.         return $this;
  663.     }
  664.     public function removeInstallationActivity(InterventionActivity $installationActivity): static
  665.     {
  666.         if ($this->installationActivities->removeElement($installationActivity)) {
  667.             // set the owning side to null (unless already changed)
  668.             if ($installationActivity->getProductInstallation() === $this) {
  669.                 $installationActivity->setProductInstallation(null);
  670.             }
  671.         }
  672.         return $this;
  673.     }
  674.     /**
  675.      * @return Collection<int, Product>
  676.      */
  677.     public function getProducts(): Collection
  678.     {
  679.         return $this->products;
  680.     }
  681.     public function addProduct(Product $product): static
  682.     {
  683.         if (!$this->products->contains($product)) {
  684.             $this->products->add($product);
  685.             $product->setParentProduct($this);
  686.         }
  687.         return $this;
  688.     }
  689.     public function removeProduct(Product $product): static
  690.     {
  691.         if ($this->products->removeElement($product)) {
  692.             // set the owning side to null (unless already changed)
  693.             if ($product->getParentProduct() === $this) {
  694.                 $product->setParentProduct(null);
  695.             }
  696.         }
  697.         return $this;
  698.     }
  699.     /**
  700.      * @return Collection<int, Supplier>
  701.      */
  702.     public function getSuppliers(): Collection
  703.     {
  704.         return $this->suppliers;
  705.     }
  706.     public function addSupplier(Supplier $supplier): static
  707.     {
  708.         if (!$this->suppliers->contains($supplier)) {
  709.             $this->suppliers->add($supplier);
  710.             $supplier->addProduct($this);
  711.         }
  712.         return $this;
  713.     }
  714.     public function removeSupplier(Supplier $supplier): static
  715.     {
  716.         if ($this->suppliers->removeElement($supplier)) {
  717.             $supplier->removeProduct($this);
  718.         }
  719.         return $this;
  720.     }
  721.     public function getDateCreation(): ?\DateTimeInterface
  722.     {
  723.         return $this->dateCreation;
  724.     }
  725.     public function setDateCreation(?\DateTimeInterface $dateCreation): static
  726.     {
  727.         $this->dateCreation $dateCreation;
  728.         return $this;
  729.     }
  730.     /**
  731.      * @return Collection<int, ProductRegenerated>
  732.      */
  733.     public function getRegeneratedProducts(): Collection
  734.     {
  735.         return $this->regeneratedProducts;
  736.     }
  737.     public function addRegeneratedProduct(ProductRegenerated $regeneratedProduct): static
  738.     {
  739.         if (!$this->regeneratedProducts->contains($regeneratedProduct)) {
  740.             $this->regeneratedProducts->add($regeneratedProduct);
  741.             $regeneratedProduct->setProduct($this);
  742.         }
  743.         return $this;
  744.     }
  745.     public function removeRegeneratedProduct(ProductRegenerated $regeneratedProduct): static
  746.     {
  747.         if ($this->regeneratedProducts->removeElement($regeneratedProduct)) {
  748.             // set the owning side to null (unless already changed)
  749.             if ($regeneratedProduct->getProduct() === $this) {
  750.                 $regeneratedProduct->setProduct(null);
  751.             }
  752.         }
  753.         return $this;
  754.     }
  755. }