<?php
namespace App\Entity\TMA;
use Doctrine\ORM\Mapping as ORM;
/**
* Job
*
* @ORM\Table(name="app_job")
* @ORM\Entity()
*/
class Job
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="title", type="string", length=255)
*/
private $title;
/**
* @var float
*
* @ORM\Column(name="duration", type="decimal", precision=15, scale=8)
*/
private $duration;
/**
* @var \DateTime
*
* @ORM\Column(name="doneDate", type="datetime", nullable=true)
*/
private $doneDate;
/**
* @var string
*
* @ORM\Column(name="comments", type="text", nullable=true)
*/
private $comments;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\TMA\Project", inversedBy="job")
*/
private $project;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set title
*
* @param string $title
* @return Job
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Set duration
*
* @param float $duration
* @return Job
*/
public function setDuration($duration)
{
$this->duration = $duration;
return $this;
}
/**
* Get duration
*
* @return float
*/
public function getDuration()
{
return $this->duration;
}
public function getRealDuration()
{
$h = floor($this->duration);
$m = $this->duration - $h;
$m = $m*60;
if($h > 0) {
$formated = $h.' h '.ceil($m).' min';
if($m == 0) {
$formated = $h . ' h';
}
} else {
$formated = ceil($m).' min';
}
return $formated ;
}
/**
* Set doneDate
*
* @param \DateTime $doneDate
* @return Job
*/
public function setDoneDate($doneDate)
{
$this->doneDate = $doneDate;
return $this;
}
/**
* Get doneDate
*
* @return \DateTime
*/
public function getDoneDate()
{
return $this->doneDate;
}
/**
* @return string
*/
public function getComments()
{
return $this->comments;
}
/**
* @param string $comments
*/
public function setComments($comments)
{
$this->comments = $comments;
}
/**
* Set project
*
* @param \App\Entity\TMA\Project $project
* @return Job
*/
public function setProject(\App\Entity\TMA\Project $project = null)
{
$this->project = $project;
return $this;
}
/**
* Get project
*
* @return \App\Entity\TMA\Project
*/
public function getProject()
{
return $this->project;
}
}