Automatic values for updated_at, created_at in Doctrine

前端 未结 5 1334
感动是毒
感动是毒 2021-01-31 07:42

I want to make fields updated_at and created_at in my Doctrine entities to update automatically.

In Ruby on Rails models there

5条回答
  •  旧巷少年郎
    2021-01-31 08:03

    I would suggest using timestampable trait

    https://symfonycasts.com/screencast/symfony4-doctrine/timestampable

    use Gedmo\Timestampable\Traits\TimestampableEntity;
    
    class Article
    {
        use TimestampableEntity;
    }
    

    will add all appropriate functionality automatically

提交回复
热议问题