I have an object with a single column of type "datetime" to store a timestamp.
protected $timestamp;
I had MySQL 5.5.40, and I found that it does not store microseconds. So I switched to 5.6.21 and imported all my tables and data.
I tried to declare the type as
* @ORM\Column(type="datetime(6)")
but it gave me a mistake. Therefore, I changed it directly to the database by doing:
ALTER TABLE symfony.hrmgmt MODIFY timestamp DATETIME(6);
In my controller, I do this:
$dt = new \DateTime('now'); $newHREvent->setTimestamp($dt);
Nevertheless, the timestamp is saved without a split second.
I can (now) manually enter datetime with fractional values ββvia SQL, but when I do this through my controller, it always stores from .000000
I believe that since Doctrine does not know that it can also store microseconds.
My version of PHP is still 5.4.34.
Thanks!
source share