Reputation: 179
I inherited from a MySQL DB with a "time" column representing a "time in the week" in the range from "00:00:00" to "167:59:59" (24*7 = 168).
The corresponding ORM declaration is :
* @var \DateTime $startTime
* @ORM\Column(name="startTime", type="interval")
Apparently Doctrine always uses DateTime (not DateInterval) with PHP, probably to keep compatible with other DB engines.
Problem is : I fail to understand how to set those values, as they always turn to NULL on persist.
For instance :
$pWeek->setEndTime(new \DateTime('T'06:00:00'));
will set a DateTime in the Entity, but NULL in database.
I think the guys who designed this have set the data directly in DB, but since there's an ORM, I need to be able to set data with it.
Upvotes: 1
Views: 1126
Reputation: 179
That's odd, but in the end that code was... working.
No idea how I came to see it fail, I guess it was likely just a cache thing.
Thanks
Upvotes: 1