microsecond submit illustration
This commit is contained in:
parent
b0db9f0dea
commit
c7daabaa5a
@ -59,7 +59,9 @@ class IllustrationController extends AbstractController
|
|||||||
// Initialisation de l'enregistrement
|
// Initialisation de l'enregistrement
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
$data = new Entity();
|
$data = new Entity();
|
||||||
$data->setSubmittime(new DateTime());
|
|
||||||
|
$nowWithMicroseconds = DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true)));
|
||||||
|
$data->setSubmittime($nowWithMicroseconds);
|
||||||
|
|
||||||
// Permission
|
// Permission
|
||||||
if(!$this->getUser()->hasRole("ROLE_ADMIN")&&($by=="admin"||$by=="update")) {
|
if(!$this->getUser()->hasRole("ROLE_ADMIN")&&($by=="admin"||$by=="update")) {
|
||||||
@ -82,9 +84,10 @@ class IllustrationController extends AbstractController
|
|||||||
|
|
||||||
// Sur validation
|
// Sur validation
|
||||||
if ($form->get('submit')->isClicked() && $form->isValid()) {
|
if ($form->get('submit')->isClicked() && $form->isValid()) {
|
||||||
$data = $form->getData();
|
$data = $form->getData();
|
||||||
$data->setSubmittime(new \DateTime());
|
$nowWithMicroseconds = DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true)));
|
||||||
$data->setUpdatetime(new \DateTime());
|
$data->setSubmittime($nowWithMicroseconds);
|
||||||
|
$data->setUpdatetime($nowWithMicroseconds);
|
||||||
$em->persist($data);
|
$em->persist($data);
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
@ -116,8 +119,9 @@ class IllustrationController extends AbstractController
|
|||||||
// Initialisation de l'enregistrement
|
// Initialisation de l'enregistrement
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
$data = new Entity();
|
$data = new Entity();
|
||||||
$data->setSubmittime(new DateTime());
|
$nowWithMicroseconds = DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true)));
|
||||||
|
$data->setSubmittime($nowWithMicroseconds);
|
||||||
|
|
||||||
// Permission
|
// Permission
|
||||||
if(!$this->getUser()->hasRole("ROLE_ADMIN")&&($by=="admin"||$by=="update")) {
|
if(!$this->getUser()->hasRole("ROLE_ADMIN")&&($by=="admin"||$by=="update")) {
|
||||||
return $this->redirectToRoute("app_home");
|
return $this->redirectToRoute("app_home");
|
||||||
@ -162,7 +166,8 @@ class IllustrationController extends AbstractController
|
|||||||
// Initialisation de l'enregistrement
|
// Initialisation de l'enregistrement
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
$data = new Entity();
|
$data = new Entity();
|
||||||
$data->setSubmittime(new DateTime());
|
$nowWithMicroseconds = DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true)));
|
||||||
|
$data->setSubmittime($nowWithMicroseconds);
|
||||||
|
|
||||||
// Permission
|
// Permission
|
||||||
if(!$this->getUser()->hasRole("ROLE_ADMIN")&&($by=="admin"||$by=="update")) {
|
if(!$this->getUser()->hasRole("ROLE_ADMIN")&&($by=="admin"||$by=="update")) {
|
||||||
@ -191,8 +196,9 @@ class IllustrationController extends AbstractController
|
|||||||
// Initialisation de l'enregistrement
|
// Initialisation de l'enregistrement
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
$data = new Entity();
|
$data = new Entity();
|
||||||
$data->setSubmittime(new \DateTime());
|
$nowWithMicroseconds = DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true)));
|
||||||
$data->setUpdatetime(new \DateTime());
|
$data->setSubmittime($nowWithMicroseconds);
|
||||||
|
$data->setUpdatetime($nowWithMicroseconds);
|
||||||
$category=$em->getRepository(Category::class)->find($categoryid);
|
$category=$em->getRepository(Category::class)->find($categoryid);
|
||||||
|
|
||||||
// Permission
|
// Permission
|
||||||
|
@ -30,12 +30,12 @@ class Illustration
|
|||||||
private $description;
|
private $description;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="datetime")
|
* @ORM\Column(type="datetime", precision=6)
|
||||||
*/
|
*/
|
||||||
private $submittime;
|
private $submittime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="datetime")
|
* @ORM\Column(type="datetime", precision=6)
|
||||||
*/
|
*/
|
||||||
private $updatetime;
|
private $updatetime;
|
||||||
|
|
||||||
@ -96,7 +96,6 @@ class Illustration
|
|||||||
public function setSubmittime(\DateTimeInterface $submittime): self
|
public function setSubmittime(\DateTimeInterface $submittime): self
|
||||||
{
|
{
|
||||||
$this->submittime = $submittime;
|
$this->submittime = $submittime;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user