Add date_create and date_update fields in Battery entity #522

This commit is contained in:
Kendrick Chan 2020-10-20 07:01:01 +08:00
parent 6a121ece81
commit 6898b9989e

View file

@ -7,6 +7,8 @@ use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use DateTime;
/**
* @ORM\Entity
* @ORM\Table(name="battery")
@ -21,6 +23,16 @@ class Battery
*/
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;
// manufacturer
/**
* @ORM\ManyToOne(targetEntity="BatteryManufacturer", inversedBy="batteries")
@ -145,6 +157,8 @@ class Battery
$this->width = 0;
$this->height = 0;
$this->total_height = 0;
$this->date_create = new DateTime();
}
public function getID()
@ -152,6 +166,16 @@ class Battery
return $this->id;
}
public function getDateCreate()
{
return $this->date_create;
}
public function getDateUpdate()
{
return $this->date_update;
}
public function setManufacturer($manufacturer)
{
$this->manufacturer = $manufacturer;