Merge branch '522-add-date_update-to-battery-fields' into 'master'
Resolve "Add date_update to battery fields" Closes #522 See merge request jankstudio/resq!606
This commit is contained in:
commit
735bcffdd8
3 changed files with 47 additions and 0 deletions
|
|
@ -37,6 +37,7 @@ class BatteryController extends APIController
|
||||||
'id' => $batt->getID(),
|
'id' => $batt->getID(),
|
||||||
'size' => $batt->getSize()->getID(),
|
'size' => $batt->getSize()->getID(),
|
||||||
'brand' => $batt->getBrand()->getID(),
|
'brand' => $batt->getBrand()->getID(),
|
||||||
|
'date_update' => $batt->getDateUpdate()->format('YmdHis'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@ use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Symfony\Component\Validator\Constraints as Assert;
|
use Symfony\Component\Validator\Constraints as Assert;
|
||||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||||
|
|
||||||
|
use DateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Entity
|
* @ORM\Entity
|
||||||
* @ORM\Table(name="battery")
|
* @ORM\Table(name="battery")
|
||||||
|
|
@ -21,6 +23,16 @@ class Battery
|
||||||
*/
|
*/
|
||||||
protected $id;
|
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
|
// manufacturer
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity="BatteryManufacturer", inversedBy="batteries")
|
* @ORM\ManyToOne(targetEntity="BatteryManufacturer", inversedBy="batteries")
|
||||||
|
|
@ -145,6 +157,8 @@ class Battery
|
||||||
$this->width = 0;
|
$this->width = 0;
|
||||||
$this->height = 0;
|
$this->height = 0;
|
||||||
$this->total_height = 0;
|
$this->total_height = 0;
|
||||||
|
|
||||||
|
$this->date_create = new DateTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getID()
|
public function getID()
|
||||||
|
|
@ -152,6 +166,16 @@ class Battery
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getDateCreate()
|
||||||
|
{
|
||||||
|
return $this->date_create;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDateUpdate()
|
||||||
|
{
|
||||||
|
return $this->date_update;
|
||||||
|
}
|
||||||
|
|
||||||
public function setManufacturer($manufacturer)
|
public function setManufacturer($manufacturer)
|
||||||
{
|
{
|
||||||
$this->manufacturer = $manufacturer;
|
$this->manufacturer = $manufacturer;
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Symfony\Component\Validator\Constraints as Assert;
|
use Symfony\Component\Validator\Constraints as Assert;
|
||||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||||
|
use DateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Entity
|
* @ORM\Entity
|
||||||
|
|
@ -20,6 +21,16 @@ class SAPBattery
|
||||||
*/
|
*/
|
||||||
protected $id;
|
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
|
// brand
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity="SAPBatteryBrand", inversedBy="batteries")
|
* @ORM\ManyToOne(targetEntity="SAPBatteryBrand", inversedBy="batteries")
|
||||||
|
|
@ -37,6 +48,7 @@ class SAPBattery
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
$this->date_create = new DateTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setID($id)
|
public function setID($id)
|
||||||
|
|
@ -50,6 +62,16 @@ class SAPBattery
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getDateCreate()
|
||||||
|
{
|
||||||
|
return $this->date_create;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDateUpdate()
|
||||||
|
{
|
||||||
|
return $this->date_update;
|
||||||
|
}
|
||||||
|
|
||||||
public function setBrand($brand)
|
public function setBrand($brand)
|
||||||
{
|
{
|
||||||
$this->brand = $brand;
|
$this->brand = $brand;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue