]> git.immae.eu Git - github/wallabag/wallabag.git/blame - src/Wallabag/CoreBundle/Helper/EntityTimestampsTrait.php
fixup! fixup! Fix documentation wording for matches/notmatches tagging rules
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Helper / EntityTimestampsTrait.php
CommitLineData
927c9e79
JB
1<?php
2
3namespace Wallabag\CoreBundle\Helper;
4
5use Doctrine\ORM\Mapping as ORM;
6
7/**
8 * Trait to handle created & updated date of an Entity.
9 */
10trait EntityTimestampsTrait
11{
12 /**
13 * @ORM\PrePersist
14 * @ORM\PreUpdate
15 */
16 public function timestamps()
17 {
18 if (null === $this->createdAt) {
19 $this->createdAt = new \DateTime();
20 }
21
22 $this->updatedAt = new \DateTime();
23 }
24}