symfony有很多有意思的traits比如timestamp等。
使用方法:
stof_doctrine_extensions: default_locale: en_US orm: default: tree: true timestampable: true # not needed: listeners are not enabled by default softdeleteable: true
然后在entity中使用:
在声名的地方添加:use GedmoTimestampableTraitsTimestampableEntity;
在类比如Entity的内部使用:use TimestampableEntity;