Doctrine 2 ORM DateTime field in identifier

前端 未结 2 1605
别跟我提以往
别跟我提以往 2020-12-04 16:09

In our DB tables, we columns refID and date are a composite primary key, with one field of the identifier being mapped as a datetime:<

2条回答
  •  长情又很酷
    2020-12-04 16:54

    Be careful with

    return new DateTimeEx('@' . $dateTime->format('U'));
    

    The timezone won't be good. You should do :

    $val = new DateTimeEx('@' . $dateTime->format('U'));
    $val->setTimezone($dateTime->getTimezone());
    
    return $val;
    

提交回复
热议问题