<?php
namespace App\Entity\Slave;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table(name="eposm_s_intervention_activity")
* @ORM\Entity
*/
class InterventionActivity
{
public function exportCSVSummary(){
$entered = false;
$html = $this->getType().': ';
if($this->getType()->isProducerWithdrawMandatory()){
if($entered) $html.= ' --- ';
if($this->getProductWithdraw() == null)
$html.= 'Ritiro (Prod. '.$this->getProducerWithdraw().')';
else
$html.= 'Ritiro ('.$this->getProductWithdraw()->getModel()->getName().' - Prod. '.$this->getProductWithdraw()->getCodeProducer().')';
$entered = true;
}
if($this->getType()->isProducerInstallationMandatory()){
if($entered) $html.= ' --- ';
if($this->getProductInstallation() == null)
$html.= 'Installazione (Prod. '.$this->getProducerInstallation().')';
else
$html.= 'Installazione ('.$this->getProductInstallation()->getModel()->getName().' - Prod. '.$this->getProductInstallation()->getCodeProducer().')';
$entered = true;
}
if($this->getType()->isProducerActualMandatory()){
if($entered) $html.= ' --- ';
if($this->getProductActual() == null)
$html.= 'Attuale (Prod. '.$this->getProducerActual().')';
else
$html.= 'Attuale ('.$this->getProductActual()->getModel()->getName().' - Prod. '.$this->getProductActual()->getCodeProducer().')';
$entered = true;
}
if($this->getType()->isSupplierWithdrawMandatory()){
if($entered) $html.= ' --- ';
if($this->getProductWithdraw() == null)
$html.= 'Ritiro (Forn. '.$this->getSupplierWithdraw().')';
else
$html.= 'Ritiro ('.$this->getProductWithdraw()->getModel()->getName().' - Forn. '.$this->getProductWithdraw()->getCodeSupplier().')';
$entered = true;
}
if($this->getType()->isSupplierInstallationMandatory()){
if($entered) $html.= ' --- ';
if($this->getProductInstallation() == null)
$html.= 'Installazione (Forn. '.$this->getSupplierInstallation().')';
else
$html.= 'Installazione ('.$this->getProductInstallation()->getModel()->getName().' - Forn. '.$this->getProductInstallation()->getCodeSupplier().')';
$entered = true;
}
if($this->getType()->isSupplierActualMandatory()){
if($entered) $html.= ' --- ';
if($this->getProductActual() == null)
$html.= 'Attuale (Forn. '.$this->getSupplierActual().')';
else
$html.= 'Attuale ('.$this->getProductActual()->getModel()->getName().' - Forn. '.$this->getProductActual()->getCodeSupplier().')';
$entered = true;
}
return $html;
}
/**
* @ORM\Column(name="id", type="bigint")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(name="producer_withdraw", type="string", nullable=true)
*/
protected $producerWithdraw;
/**
* @ORM\Column(name="producer_installation", type="string", nullable=true)
*/
protected $producerInstallation;
/**
* @ORM\Column(name="producer_actual", type="string", nullable=true)
*/
protected $producerActual;
/**
* @ORM\Column(name="supplier_withdraw", type="string", nullable=true)
*/
protected $supplierWithdraw;
/**
* @ORM\Column(name="supplier_installation", type="string", nullable=true)
*/
protected $supplierInstallation;
/**
* @ORM\Column(name="supplier_actual", type="string", nullable=true)
*/
protected $supplierActual;
/**
* @ORM\Column(name="components", type="array", nullable=true)
*/
protected $components;
// ManyToOne
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Slave\InterventionActivityType", inversedBy="activities")
* @ORM\JoinColumn(name="type_id", referencedColumnName="id")
*/
private $type;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Slave\Product", inversedBy="withdrawActivities")
* @ORM\JoinColumn(name="product_withdraw_id", referencedColumnName="id")
*/
private $productWithdraw;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Slave\Product", inversedBy="actualActivities")
* @ORM\JoinColumn(name="product_actual_id", referencedColumnName="id")
*/
private $productActual;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Slave\Product", inversedBy="installationActivities")
* @ORM\JoinColumn(name="product_installation_id", referencedColumnName="id")
*/
private $productInstallation;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Slave\Intervention", inversedBy="activities")
* @ORM\JoinColumn(name="intervention_id", referencedColumnName="id")
*/
private $intervention;
//
public function getId(): ?string
{
return $this->id;
}
public function getProducerWithdraw(): ?string
{
return $this->producerWithdraw;
}
public function setProducerWithdraw(?string $producerWithdraw): static
{
$this->producerWithdraw = $producerWithdraw;
return $this;
}
public function getProducerInstallation(): ?string
{
return $this->producerInstallation;
}
public function setProducerInstallation(?string $producerInstallation): static
{
$this->producerInstallation = $producerInstallation;
return $this;
}
public function getProducerActual(): ?string
{
return $this->producerActual;
}
public function setProducerActual(?string $producerActual): static
{
$this->producerActual = $producerActual;
return $this;
}
public function getSupplierWithdraw(): ?string
{
return $this->supplierWithdraw;
}
public function setSupplierWithdraw(?string $supplierWithdraw): static
{
$this->supplierWithdraw = $supplierWithdraw;
return $this;
}
public function getSupplierInstallation(): ?string
{
return $this->supplierInstallation;
}
public function setSupplierInstallation(?string $supplierInstallation): static
{
$this->supplierInstallation = $supplierInstallation;
return $this;
}
public function getSupplierActual(): ?string
{
return $this->supplierActual;
}
public function setSupplierActual(?string $supplierActual): static
{
$this->supplierActual = $supplierActual;
return $this;
}
public function getComponents(): ?array
{
return $this->components;
}
public function setComponents(?array $components): static
{
$this->components = $components;
return $this;
}
public function getType(): ?InterventionActivityType
{
return $this->type;
}
public function setType(?InterventionActivityType $type): static
{
$this->type = $type;
return $this;
}
public function getProductWithdraw(): ?Product
{
return $this->productWithdraw;
}
public function setProductWithdraw(?Product $productWithdraw): static
{
$this->productWithdraw = $productWithdraw;
return $this;
}
public function getProductActual(): ?Product
{
return $this->productActual;
}
public function setProductActual(?Product $productActual): static
{
$this->productActual = $productActual;
return $this;
}
public function getProductInstallation(): ?Product
{
return $this->productInstallation;
}
public function setProductInstallation(?Product $productInstallation): static
{
$this->productInstallation = $productInstallation;
return $this;
}
public function getIntervention(): ?Intervention
{
return $this->intervention;
}
public function setIntervention(?Intervention $intervention): static
{
$this->intervention = $intervention;
return $this;
}
}