Completed
Push — develop ( 771d14...2a7966 )
by Daniel
06:05
created

FeatureColumnsItem::getDescription()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Silverback\ApiComponentBundle\Entity\Content\Component\Feature\Columns;
4
5
use ApiPlatform\Core\Annotation\ApiResource;
6
use Doctrine\ORM\Mapping as ORM;
7
use Silverback\ApiComponentBundle\Entity\Content\Component\Feature\AbstractFeatureItem;
8
use Silverback\ApiComponentBundle\Entity\Content\FileInterface;
9
use Silverback\ApiComponentBundle\Entity\Content\FileTrait;
10
use Symfony\Component\Serializer\Annotation\Groups;
11
use Symfony\Component\Validator\Constraints as Assert;
12
use Symfony\Component\Validator\Mapping\ClassMetadata;
13
14
/**
15
 * Class FeatureColumnsItem
16
 * @package Silverback\ApiComponentBundle\Entity\Content\Component\FeatureList
17
 * @author Daniel West <[email protected]>
18
 * @ApiResource()
19
 * @ORM\Entity()
20
 */
21
class FeatureColumnsItem extends AbstractFeatureItem implements FileInterface
22
{
23
    use FileTrait;
24
25
    /**
26
     * @ORM\Column()
27
     * @Groups({"component", "content"})
28
     * @var null|string
29
     */
30
    protected $description;
31
32 4
    public static function loadValidatorMetadata(ClassMetadata $metadata)
33
    {
34 4
        $metadata->addPropertyConstraint(
35 4
            'filePath',
36 4
            new Assert\Image()
37
        );
38 4
    }
39
40
    /**
41
     * @return null|string
42
     */
43 1
    public function getDescription(): ?string
44
    {
45 1
        return $this->description;
46
    }
47
48
    /**
49
     * @param null|string $description
50
     */
51 1
    public function setDescription(?string $description): void
52
    {
53 1
        $this->description = $description;
54 1
    }
55
}
56