<?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_request")
* @ORM\Entity(repositoryClass="App\Repository\Slave\ProductRequestRepository")
*/
class ProductRequest
{
public function displayDetails()
{
$json = json_decode($this->details, true);
if($json != null && array_key_exists('qty', $json)) $qty = $json['qty']; else $qty = "";
if($json != null && array_key_exists('modelName', $json)) $modelName = $json['modelName']; else $modelName = "";
if($json != null && array_key_exists('producerName', $json)) $producerName = $json['producerName']; else $producerName = "";
if($json != null && array_key_exists('supplierName', $json)) $supplierName = $json['supplierName']; else $supplierName = "";
return
'<table class="table table_no_padding b_none m_b_none responsive_font_size">
<thead>
<tr>
<th class="td_w_40p txt_a_c"><label class="m_b_none l_s_none font_12">Qtà</label></th>
<th class="td_w_400p"><label class="m_b_none l_s_none font_12">Modello</label></th>
<th class="td_w_150p"><label class="m_b_none l_s_none font_12">Produttore</label></th>
<th class="td_w_150p"><label class="m_b_none l_s_none font_12">Fornitore</label></th>
</tr>
</thead>
<tbody>
<tr>
<td class="txt_a_c">'.$qty.'</td>
<td>'.$modelName.'</td>
<td>'.$producerName.'</td>
<td>'.$supplierName.'</td>
</tr>
</tbody>
</table>';
}
/**
* @ORM\Column(name="id", type="bigint")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(name="phase", type="string", length=191)
*/
protected $phase;
/**
* @ORM\Column(name="datetime", type="datetime", nullable=true)
*/
protected $datetime;
/**
* @ORM\Column(name="details", type="text")
*/
protected $details;
/**
* @ORM\Column(name="notes", type="text", nullable=true)
*/
protected $notes;
// ManyToOne
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Slave\User", inversedBy="productRequests")
* @ORM\JoinColumn(name="technician_id", referencedColumnName="id")
*/
private $technician;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Slave\Warehouse", inversedBy="productRequests")
* @ORM\JoinColumn(name="warehouse_id", referencedColumnName="id")
*/
private $warehouse;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Slave\Warehouse", inversedBy="headquarterProductRequests")
* @ORM\JoinColumn(name="warehouse_headquarter_id", referencedColumnName="id")
*/
private $warehouseHeadquarter;
//
public function getId(): ?string
{
return $this->id;
}
public function getPhase(): ?string
{
return $this->phase;
}
public function setPhase(string $phase): static
{
$this->phase = $phase;
return $this;
}
public function getDatetime(): ?\DateTimeInterface
{
return $this->datetime;
}
public function setDatetime(?\DateTimeInterface $datetime): static
{
$this->datetime = $datetime;
return $this;
}
public function getDetails(): ?string
{
return $this->details;
}
public function setDetails(string $details): static
{
$this->details = $details;
return $this;
}
public function getNotes(): ?string
{
return $this->notes;
}
public function setNotes(?string $notes): static
{
$this->notes = $notes;
return $this;
}
public function getTechnician(): ?User
{
return $this->technician;
}
public function setTechnician(?User $technician): static
{
$this->technician = $technician;
return $this;
}
public function getWarehouse(): ?Warehouse
{
return $this->warehouse;
}
public function setWarehouse(?Warehouse $warehouse): static
{
$this->warehouse = $warehouse;
return $this;
}
public function getWarehouseHeadquarter(): ?Warehouse
{
return $this->warehouseHeadquarter;
}
public function setWarehouseHeadquarter(?Warehouse $warehouseHeadquarter): static
{
$this->warehouseHeadquarter = $warehouseHeadquarter;
return $this;
}
}