开发者

short timestamp in symfony 1.4 and doctrine 1.2

开发者 https://www.devze.com 2023-03-10 15:01 出处:网络
I generated new project in Symfony and I used Doctrine: expires_at:{ ty开发者_开发问答pe: timestamp, notnull: true }

I generated new project in Symfony and I used Doctrine:

expires_at:   { ty开发者_开发问答pe: timestamp, notnull: true }

but it is too long for me. I need only 2011/06/05. How can I achieve this? The widget in the form is asking for too much. One must also fill in for example milliseconds.

This:

unset(
  $this['expires_at']
);

deleted all field in the widget. I would like something like that remained 2011/06/05.


doctrine has a special datatype for this purpose : http://www.doctrine-project.org/documentation/manual/1_2/pl/defining-models:columns:data-types#date

Put this in your schema.yml :

expires_at:   { type: date, notnull: true }

and regenerate your form.

0

精彩评论

暂无评论...
验证码 换一张
取 消