Add date_create and date_update to SAPBattery entity #522

This commit is contained in:
Kendrick Chan 2020-10-20 07:38:47 +08:00
parent 6898b9989e
commit 74928f196b

View file

@ -6,6 +6,7 @@ use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use DateTime;
/**
* @ORM\Entity
@ -20,6 +21,16 @@ class SAPBattery
*/
protected $id;
/**
* @ORM\Column(type="datetime")
*/
protected $date_create;
/**
* @ORM\Column(type="datetime", columnDefinition="timestamp default current_timestamp on update current_timestamp")
*/
protected $date_update;
// brand
/**
* @ORM\ManyToOne(targetEntity="SAPBatteryBrand", inversedBy="batteries")
@ -37,6 +48,7 @@ class SAPBattery
public function __construct()
{
$this->date_create = new DateTime();
}
public function setID($id)
@ -50,6 +62,16 @@ class SAPBattery
return $this->id;
}
public function getDateCreate()
{
return $this->date_create;
}
public function getDateUpdate()
{
return $this->date_update;
}
public function setBrand($brand)
{
$this->brand = $brand;