TimestampableEntity::setCreatedAt()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
ccs 0
cts 4
cp 0
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php declare(strict_types = 1);
2
3
namespace Simplex\Quickstart\Shared\Doctrine;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Gedmo\Mapping\Annotation as Gedmo;
7
use JMS\Serializer\Annotation as Serializer;
8
9
trait TimestampableEntity
10
{
11
    /**
12
     * @var \DateTime
13
     *
14
     * @Gedmo\Timestampable(on="create")
15
     * @ORM\Column(type="datetime")
16
     *
17
     * @Serializer\Exclude()
18
     */
19
    protected $createdAt;
20
21
    /**
22
     * @var \DateTime
23
     *
24
     * @Gedmo\Timestampable(on="update")
25
     * @ORM\Column(type="datetime")
26
     *
27
     * @Serializer\Exclude()
28
     */
29
    protected $updatedAt;
30
31
    public function setCreatedAt(\DateTime $createdAt): self
32
    {
33
        $this->createdAt = $createdAt;
34
35
        return $this;
36
    }
37
38
    public function getCreatedAt(): \DateTime
39
    {
40
        return $this->createdAt;
41
    }
42
43
    public function setUpdatedAt(\DateTime $updatedAt): self
44
    {
45
        $this->updatedAt = $updatedAt;
46
47
        return $this;
48
    }
49
50
    public function getUpdatedAt(): \DateTime
51
    {
52
        return $this->updatedAt;
53
    }
54
}
55