src/Entity/TMA/Job.php line 178

Open in your IDE?
  1. <?php
  2. namespace App\Entity\TMA;
  3. use Doctrine\ORM\Mapping as ORM;
  4. /**
  5.  * Job
  6.  *
  7.  * @ORM\Table(name="app_job")
  8.  * @ORM\Entity()
  9.  */
  10. class Job
  11. {
  12.     /**
  13.      * @var int
  14.      *
  15.      * @ORM\Column(name="id", type="integer")
  16.      * @ORM\Id
  17.      * @ORM\GeneratedValue(strategy="AUTO")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @var string
  22.      *
  23.      * @ORM\Column(name="title", type="string", length=255)
  24.      */
  25.     private $title;
  26.     /**
  27.      * @var float
  28.      *
  29.      * @ORM\Column(name="duration", type="decimal", precision=15, scale=8)
  30.      */
  31.     private $duration;
  32.     /**
  33.      * @var \DateTime
  34.      *
  35.      * @ORM\Column(name="doneDate", type="datetime", nullable=true)
  36.      */
  37.     private $doneDate;
  38.     /**
  39.      * @var string
  40.      *
  41.      * @ORM\Column(name="comments", type="text", nullable=true)
  42.      */
  43.     private $comments;
  44.     /**
  45.      * @ORM\ManyToOne(targetEntity="App\Entity\TMA\Project", inversedBy="job")
  46.      */
  47.     private $project;
  48.     /**
  49.      * Get id
  50.      *
  51.      * @return integer 
  52.      */
  53.     public function getId()
  54.     {
  55.         return $this->id;
  56.     }
  57.     /**
  58.      * Set title
  59.      *
  60.      * @param string $title
  61.      * @return Job
  62.      */
  63.     public function setTitle($title)
  64.     {
  65.         $this->title = $title;
  66.     
  67.         return $this;
  68.     }
  69.     /**
  70.      * Get title
  71.      *
  72.      * @return string 
  73.      */
  74.     public function getTitle()
  75.     {
  76.         return $this->title;
  77.     }
  78.     /**
  79.      * Set duration
  80.      *
  81.      * @param float $duration
  82.      * @return Job
  83.      */
  84.     public function setDuration($duration)
  85.     {
  86.         $this->duration = $duration;
  87.     
  88.         return $this;
  89.     }
  90.     /**
  91.      * Get duration
  92.      *
  93.      * @return float 
  94.      */
  95.     public function getDuration()
  96.     {
  97.         return $this->duration;
  98.     }
  99.     public function getRealDuration()
  100.     {
  101.         $h = floor($this->duration);
  102.         $m = $this->duration - $h;
  103.         $m = $m*60;
  104.         if($h > 0) {
  105.             $formated = $h.' h '.ceil($m).' min';
  106.             if($m == 0) {
  107.                 $formated = $h . ' h';
  108.             }
  109.         } else {
  110.             $formated = ceil($m).' min';
  111.         }
  112.         return $formated    ;
  113.     }
  114.     /**
  115.      * Set doneDate
  116.      *
  117.      * @param \DateTime $doneDate
  118.      * @return Job
  119.      */
  120.     public function setDoneDate($doneDate)
  121.     {
  122.         $this->doneDate = $doneDate;
  123.     
  124.         return $this;
  125.     }
  126.     /**
  127.      * Get doneDate
  128.      *
  129.      * @return \DateTime 
  130.      */
  131.     public function getDoneDate()
  132.     {
  133.         return $this->doneDate;
  134.     }
  135.     /**
  136.      * @return string
  137.      */
  138.     public function getComments()
  139.     {
  140.         return $this->comments;
  141.     }
  142.     /**
  143.      * @param string $comments
  144.      */
  145.     public function setComments($comments)
  146.     {
  147.         $this->comments = $comments;
  148.     }
  149.     /**
  150.      * Set project
  151.      *
  152.      * @param \App\Entity\TMA\Project $project
  153.      * @return Job
  154.      */
  155.     public function setProject(\App\Entity\TMA\Project $project = null)
  156.     {
  157.         $this->project = $project;
  158.     
  159.         return $this;
  160.     }
  161.     /**
  162.      * Get project
  163.      *
  164.      * @return \App\Entity\TMA\Project
  165.      */
  166.     public function getProject()
  167.     {
  168.         return $this->project;
  169.     }
  170. }