This bundle allows you to simply add use TimestampInterface
and use TimestampTrait
to a doctrine entity class to have
it automatically add created_at and updated_at fields and to
have them updated on insert and update.
composer require incompass/timestampablebundle
Add the TimestampInterface to your doctrine entities.
class {Entity} implements TimestampInterface
Add the TimestampTrait trait to your doctrine entities.
use TimestampTrait
Update your database schema
php bin/console doctrine:schema:update --force
All entities will now be saved with created_at and updated_at fields populated.
Joe Mizzi (casechek/incompass)