I have an Entity with a time property.
In the form i have a TimeType.
The time I write in the form is exactly the time stored in DB ex. 14:54. But when I get it back from my DB I got 13:54.
I guess it's a timezone issue but I can't figure out how to deal with this.
I tried setting model_timezone
and view_timezone
but it doesn't seem the change anything.
My issue is wioth the startTime property
EDIT : Here's some code
Entity
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
/**
* BookingSession
*
* @ORM\Table(name="booking_session")
* @ORM\Entity(repositoryClass="AppBundle\Repository\BookingSessionRepository")
*/
class BookingSession
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @Groups({"base"})
*/
private $id;
/**
* @var \DateTime
*
* @ORM\Column(name="date", type="datetimetz")
* @Groups({"base"})
*/
private $date;
/**
* @var \DateTime
*
* @ORM\Column(name="startTime", type="time")
* @Groups({"base"})
*/
private $startTime;
//...
The form
$builder
->add('startTime', 'time',['widget' => 'single_text','hours'=>$hours,"label"=>false,"attr"=>['class'=>'hidden']])