Passed
Pull Request — master (#50)
by Daniel
07:31
created

MediaObject::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 1
c 1
b 1
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
/*
4
 * This file is part of the Silverback API Component Bundle Project
5
 *
6
 * (c) Daniel West <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Silverback\ApiComponentBundle\Entity\Uploadable;
15
16
use ApiPlatform\Core\Annotation\ApiResource;
17
use Doctrine\ORM\Mapping as ORM;
18
use Silverback\ApiComponentBundle\Annotation as Silverback;
19
use Silverback\ApiComponentBundle\Entity\Utility\IdTrait;
20
use Silverback\ApiComponentBundle\Entity\Utility\TimestampedTrait;
21
use Silverback\ApiComponentBundle\Model\Uploadable\FileData;
22
use Symfony\Component\HttpFoundation\File\File;
23
use Symfony\Component\Validator\Constraints as Assert;
24
25
/**
26
 * @author Daniel West <[email protected]>
27
 *
28
 * @Silverback\MediaObject
29
 * @Silverback\Timestamped
30
 * @ApiResource
31
 * @ORM\Entity
32
 */
33
class MediaObject
34
{
35
    use IdTrait;
36
    use TimestampedTrait;
37
38
    /**
39
     * @Assert\NotNull(groups={"MediaObject:write"})
40
     */
41
    public File $file;
42
43
    public string $filePath;
44
45
    public bool $temporary = true;
46
47
    public FileData $fileData;
48
49
    public function __construct()
50
    {
51
        $this->setId();
52
    }
53
}
54