From 927c9e796ff6fad2bf82a965234f52932cdee657 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 6 Jul 2017 09:00:37 +0200 Subject: Add EntityTimestampsTrait to handle dates Refactorize timestamps() method to avoid re-writing it on each entity --- .../CoreBundle/Helper/EntityTimestampsTrait.php | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/Wallabag/CoreBundle/Helper/EntityTimestampsTrait.php (limited to 'src/Wallabag/CoreBundle/Helper/EntityTimestampsTrait.php') diff --git a/src/Wallabag/CoreBundle/Helper/EntityTimestampsTrait.php b/src/Wallabag/CoreBundle/Helper/EntityTimestampsTrait.php new file mode 100644 index 00000000..1b1ff54a --- /dev/null +++ b/src/Wallabag/CoreBundle/Helper/EntityTimestampsTrait.php @@ -0,0 +1,24 @@ +createdAt) { + $this->createdAt = new \DateTime(); + } + + $this->updatedAt = new \DateTime(); + } +} -- cgit v1.2.3