Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
joubertredrat committed Jun 19, 2018
1 parent bbdcb9e commit 522f8a7
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,34 @@
# entity-datetime
# Entity datetime

Trait for easy manage useful datetime in entities.

#### Usage

##### With Doctrine

1 - Add trait in your Entity

```php
<?php

use RedRat\Entity\DateTimeTrait;

class Foo
{
use DateTimeTrait;
}
```

2 - Set `lifecycleCallbacks` in your Doctrine configuration, like example below:

```yaml
lifecycleCallbacks:
prePersist: [ forgeCreatedAt ]
preUpdate: [ forgeUpdatedAt ]
```
Note: More about lifecycle callbacks in Doctrine [documentation](https://www.doctrine-project.org/projects/doctrine-orm/en/2.7/reference/events.html#lifecycle-callbacks).
#### TODO
* API documentation.

0 comments on commit 522f8a7

Please sign in to comment.