如何在symfony2中设置创建和更新日期? [英] How to set created and updated date in symfony2?
问题描述
我正在创建一个待办事项应用程序,用户可以在其中创建任务。用户可以选择插入标题,截止日期,完成。我希望能够在用户创建任务时自动插入创建和更新的日期。
一个更好的解决方案是使用来自gedmo的Doctrine的时间戳扩展:
https:// github .com / Atlantic18 / DoctrineExtensions / blob / master / doc / timestampable.md 。和更新的时间戳。
I am creating a todo app where the user can create tasks.The user has the options of inserting title, due date, completed. I want to be able to insert created and updated date automatically when the user creates the task.
A better solution is to use the Timestampable extension for Doctrine from gedmo: https://github.com/Atlantic18/DoctrineExtensions/blob/master/doc/timestampable.md.
This extension uses lifecyclecallbacks, but it is a cleaner way to set created and updated timestamps.
这篇关于如何在symfony2中设置创建和更新日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!