BaseMedia::prePersist()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Sonata Project package.
7
 *
8
 * (c) Thomas Rabaix <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Sonata\MediaBundle\PHPCR;
15
16
use Sonata\MediaBundle\Model\Media;
17
18
abstract class BaseMedia extends Media
19
{
20
    /**
21
     * @var string
22
     */
23
    private $uuid;
24
25
    /**
26
     * Get universal unique id.
27
     *
28
     * @return string
29
     */
30
    public function getUuid()
31
    {
32
        return $this->uuid;
33
    }
34
35
    public function prePersist(): void
36
    {
37
        $this->createdAt = new \DateTime();
38
        $this->updatedAt = new \DateTime();
39
    }
40
41
    public function preUpdate(): void
42
    {
43
        $this->updatedAt = new \DateTime();
44
    }
45
}
46