<?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_product_log")
* @ORM\Entity(repositoryClass="App\Repository\Slave\ProductLogRepository")
*/
class ProductLog
{
public function displayHtml(){
$html = '<table class="table table_no_padding b_none m_b_none"><tr><th class="td_w_70p">Utente</th><td>'.$this->getOperator().'</td></tr><tr><th>Prodotto</th><td>'.$this->getModel();
if($this->getCodeProducer() != null) $html.= ' --- Matricola produttore: '.$this->getCodeProducer();
if($this->getCodeSupplier() != null) $html.= ' --- Matricola produttore: '.$this->getCodeSupplier();
$html.= '</td></tr><tr><th>Modifica a</th><td>';
switch($this->getType()){
case 'status': $html.= 'Stato'; break;
case 'condition': $html.= 'Condizione'; break;
case 'code-producer': $html.= 'Matricola produttore'; break;
case 'code-supplier': $html.= 'Matricola fornitore'; break;
default: break;
}
$html.= '</td><tr><th>Da</th><td>'.$this->getOldValue().'</td></tr><tr><th>A</th><td>'.$this->getNewValue().'</td></th></tr></table>';
return $html;
}
/**
* @ORM\Column(name="id", type="bigint")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(name="text", type="text", nullable=true)
*/
protected $text;
/**
* @ORM\Column(name="datetime", type="datetime")
*/
protected $datetime;
/**
* @ORM\Column(name="operator", type="string", length=191)
*/
protected $operator;
/**
* @ORM\Column(name="model", type="string", length=191)
*/
protected $model;
/**
* @ORM\Column(name="code_producer", type="string", length=191, nullable=true)
*/
protected $codeProducer;
/**
* @ORM\Column(name="code_supplier", type="string", length=191, nullable=true)
*/
protected $codeSupplier;
/**
* @ORM\Column(name="type", type="string", length=191)
*/
protected $type;
/**
* @ORM\Column(name="old_value", type="string", length=191)
*/
protected $oldValue;
/**
* @ORM\Column(name="new_value", type="string", length=191)
*/
protected $newValue;
/**
* @ORM\Column(name="old_data_id", type="string", length=191, nullable=true)
*/
protected $oldDataId;
// ManyToOne
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Slave\Product", inversedBy="logs")
* @ORM\JoinColumn(name="product_id", referencedColumnName="id")
*/
private $product;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Slave\User", inversedBy="productLogs")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
*/
private $user;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Slave\Intervention", inversedBy="productLogs")
* @ORM\JoinColumn(name="intervention_id", referencedColumnName="id")
*/
private $intervention;
//
public function getId(): ?string
{
return $this->id;
}
public function getText(): ?string
{
return $this->text;
}
public function setText(?string $text): static
{
$this->text = $text;
return $this;
}
public function getDatetime(): ?\DateTimeInterface
{
return $this->datetime;
}
public function setDatetime(\DateTimeInterface $datetime): static
{
$this->datetime = $datetime;
return $this;
}
public function getOperator(): ?string
{
return $this->operator;
}
public function setOperator(string $operator): static
{
$this->operator = $operator;
return $this;
}
public function getModel(): ?string
{
return $this->model;
}
public function setModel(string $model): static
{
$this->model = $model;
return $this;
}
public function getCodeProducer(): ?string
{
return $this->codeProducer;
}
public function setCodeProducer(?string $codeProducer): static
{
$this->codeProducer = $codeProducer;
return $this;
}
public function getCodeSupplier(): ?string
{
return $this->codeSupplier;
}
public function setCodeSupplier(?string $codeSupplier): static
{
$this->codeSupplier = $codeSupplier;
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(string $type): static
{
$this->type = $type;
return $this;
}
public function getOldValue(): ?string
{
return $this->oldValue;
}
public function setOldValue(string $oldValue): static
{
$this->oldValue = $oldValue;
return $this;
}
public function getNewValue(): ?string
{
return $this->newValue;
}
public function setNewValue(string $newValue): static
{
$this->newValue = $newValue;
return $this;
}
public function getOldDataId(): ?string
{
return $this->oldDataId;
}
public function setOldDataId(?string $oldDataId): static
{
$this->oldDataId = $oldDataId;
return $this;
}
public function getProduct(): ?Product
{
return $this->product;
}
public function setProduct(?Product $product): static
{
$this->product = $product;
return $this;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): static
{
$this->user = $user;
return $this;
}
public function getIntervention(): ?Intervention
{
return $this->intervention;
}
public function setIntervention(?Intervention $intervention): static
{
$this->intervention = $intervention;
return $this;
}
}