forked from wallabag/wallabag
Move source files directly under src/ directory
This commit is contained in:
24
src/Helper/EntityTimestampsTrait.php
Normal file
24
src/Helper/EntityTimestampsTrait.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Wallabag\CoreBundle\Helper;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* Trait to handle created & updated date of an Entity.
|
||||
*/
|
||||
trait EntityTimestampsTrait
|
||||
{
|
||||
/**
|
||||
* @ORM\PrePersist
|
||||
* @ORM\PreUpdate
|
||||
*/
|
||||
public function timestamps()
|
||||
{
|
||||
if (null === $this->createdAt) {
|
||||
$this->createdAt = new \DateTime();
|
||||
}
|
||||
|
||||
$this->updatedAt = new \DateTime();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user