todstoychev / timestampable
Automatic timestamps for Symfony entities.
Package info
github.com/todstoychev/timestampable
Type:bundle
pkg:composer/todstoychev/timestampable
3.2.0
2022-02-20 14:05 UTC
Requires
- php: >=8.0
- symfony/config: >=6.0.0
- symfony/orm-pack: >=2.0.0
This package is not auto-updated.
Last update: 2026-03-02 08:50:29 UTC
README
- symfony >= 3.0
- php >= 7.0
Installation
Nothing special:
composer require todstoychev/timestampable;- Add to AppKernel
new Todstoychev\Timestampable\TimestampableBundle(),
Usage
Entity that will use automatic timestamps should implement Todstoychev\TimestampableBundle\Entity\TimestampableInterface.
The interface implementation is released in Todstoychev\TimestampableBundle\Entity\Timestampable trait.
So in your entity:
use Todstoychev\TimestampableBundle\Entity\Timestampable; use Todstoychev\TimestampableBundle\Entity\Timestampable; class MyEntity implements TimestampableInterface { use Timestampable; }
Timestampable trait adds to entity 2 fields: createdAt and updatedAt. Describe those 2 in your entity configuration. If you are using anotations, override those 2 properties in your entity class.
That's all.