TimestampableTrait::setUpdatedAt()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 6
rs 9.4285
1
<?php
2
/*
3
 * This file is part of the FreshTimestampableEntityBundle
4
 *
5
 * (c) Artem Henvald <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
declare(strict_types=1);
12
13
namespace Fresh\TimestampableEntityBundle\Traits;
14
15
use Doctrine\ORM\Mapping as ORM;
16
use Symfony\Component\Validator\Constraints as Assert;
17
18
/**
19
 * Methods and properties for timestampable entity.
20
 *
21
 * @author Artem Henvald <[email protected]>
22
 */
23
trait TimestampableTrait
24
{
25
    /**
26
     * @var \DateTimeImmutable
27
     *
28
     * @Assert\Type("\DateTimeImmutable")
29
     *
30
     * @ORM\Column(type="datetime", nullable=false)
31
     */
32
    protected $createdAt;
33
34
    /**
35
     * @var \DateTime
36
     *
37
     * @Assert\Type("\DateTime")
38
     *
39
     * @ORM\Column(type="datetime", nullable=false)
40
     */
41
    protected $updatedAt;
42
43
    /**
44
     * @return \DateTimeImmutable|null
45
     */
46
    public function getCreatedAt(): ?\DateTimeImmutable
47
    {
48
        return $this->createdAt;
49
    }
50
51
    /**
52
     * @param \DateTimeImmutable $createdAt
53
     *
54
     * @return $this
55
     */
56
    public function setCreatedAt(\DateTimeImmutable $createdAt)
57
    {
58
        $this->createdAt = $createdAt;
59
60
        return $this;
61
    }
62
63
    /**
64
     * @return \DateTime|null
65
     */
66
    public function getUpdatedAt(): ?\DateTime
67
    {
68
        return $this->updatedAt;
69
    }
70
71
    /**
72
     * @param \DateTime $updatedAt
73
     *
74
     * @return $this
75
     */
76
    public function setUpdatedAt(\DateTime $updatedAt)
77
    {
78
        $this->updatedAt = $updatedAt;
79
80
        return $this;
81
    }
82
}
83