Skip to content

Commit 522f8a7

Browse files
committed
Update readme
1 parent bbdcb9e commit 522f8a7

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

README.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,34 @@
1-
# entity-datetime
1+
# Entity datetime
2+
3+
Trait for easy manage useful datetime in entities.
4+
5+
#### Usage
6+
7+
##### With Doctrine
8+
9+
1 - Add trait in your Entity
10+
11+
```php
12+
<?php
13+
14+
use RedRat\Entity\DateTimeTrait;
15+
16+
class Foo
17+
{
18+
use DateTimeTrait;
19+
}
20+
```
21+
22+
2 - Set `lifecycleCallbacks` in your Doctrine configuration, like example below:
23+
24+
```yaml
25+
lifecycleCallbacks:
26+
prePersist: [ forgeCreatedAt ]
27+
preUpdate: [ forgeUpdatedAt ]
28+
```
29+
30+
Note: More about lifecycle callbacks in Doctrine [documentation](https://www.doctrine-project.org/projects/doctrine-orm/en/2.7/reference/events.html#lifecycle-callbacks).
31+
32+
#### TODO
33+
34+
* API documentation.

0 commit comments

Comments
 (0)