<?php
namespace App\Entity\Slave;
use App\Twig\Extension\AppExtension;
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_extra")
* @ORM\Entity
*/
class InterventionExtra
{
public function displayType()
{
switch($this->getType()){
case 'hours': return 'Ore'; break;
case 'cost': return 'Spesa'; break;
case 'tariff_extra': return 'Integrazione tariffa'; break;
case 'tariff_out': return 'Tariffa fuori copertura'; break;
default: break;
}
}
public function displayResume(){
$string = "";
switch($this->getType()){
case 'hours': $string.= $this->hours.' Ore'; break;
case 'cost': $string.= 'Spesa'; break;
case 'tariff_extra':$string.= 'Integrazione tariffa'; break;
case 'tariff_out': $string.= 'Tariffa fuori copertura'; break;
}
$string.= " - ".$this->cost." € - ";
if(!$this->managed)
$string.=" Da gestire";
else{
if($this->approved)
$string.=" Approvata";
else
$string.=" Non approvata";
}
return $string;
}
/**
* @ORM\Column(name="id", type="bigint")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(name="type", type="string", length=191)
*/
protected $type;
/**
* @ORM\Column(name="cost", type="decimal", scale=2, nullable=true)
*/
protected $cost;
/**
* @ORM\Column(name="hours", type="string", length=191, nullable=true)
*/
protected $hours;
/**
* @ORM\Column(name="file_path", type="string", length=191, nullable=true)
*/
protected $filePath;
/**
* @ORM\Column(name="notes", type="text", nullable=true)
*/
protected $notes;
/**
* @ORM\Column(name="is_tariff_out", type="boolean")
*/
protected $tariffOut = false;
/**
* @ORM\Column(name="is_approved", type="boolean", nullable=true)
*/
protected $approved;
/**
* @ORM\Column(name="is_managed", type="boolean")
*/
protected $managed = false;
// ManyToOne
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Slave\Intervention", inversedBy="extras")
* @ORM\JoinColumn(name="intervention_id", referencedColumnName="id")
*/
private $intervention;
//
public function getId(): ?string
{
return $this->id;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(string $type): self
{
$this->type = $type;
return $this;
}
public function getCost(): ?string
{
return $this->cost;
}
public function setCost(?string $cost): self
{
$this->cost = $cost;
return $this;
}
public function getHours(): ?string
{
return $this->hours;
}
public function setHours(?string $hours): self
{
$this->hours = $hours;
return $this;
}
public function getFilePath(): ?string
{
return $this->filePath;
}
public function setFilePath(?string $filePath): self
{
$this->filePath = $filePath;
return $this;
}
public function getNotes(): ?string
{
return $this->notes;
}
public function setNotes(?string $notes): self
{
$this->notes = $notes;
return $this;
}
public function isApproved(): ?bool
{
return $this->approved;
}
public function setApproved(?bool $approved): self
{
$this->approved = $approved;
return $this;
}
public function isManaged(): ?bool
{
return $this->managed;
}
public function setManaged(bool $managed): self
{
$this->managed = $managed;
return $this;
}
public function getIntervention(): ?Intervention
{
return $this->intervention;
}
public function setIntervention(?Intervention $intervention): self
{
$this->intervention = $intervention;
return $this;
}
public function isTariffOut(): ?bool
{
return $this->tariffOut;
}
public function setTariffOut(bool $tariffOut): static
{
$this->tariffOut = $tariffOut;
return $this;
}
}