Passed
Push — develop ( 5d2ce0...8a9894 )
by Daniel
04:55
created

Layout::setNavBar()   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 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Silverback\ApiComponentBundle\Entity\Layout;
4
5
use ApiPlatform\Core\Annotation\ApiResource;
6
use Doctrine\ORM\Mapping as ORM;
7
use Ramsey\Uuid\Uuid;
8
use Silverback\ApiComponentBundle\Entity\Layout\NavBar\NavBar;
9
use Symfony\Component\Serializer\Annotation\Groups;
10
11
/**
12
 * Class Layout
13
 * @package Silverback\ApiComponentBundle\Entity\Layout
14
 * @ApiResource()
15
 * @ORM\Entity(repositoryClass="Silverback\ApiComponentBundle\Repository\LayoutRepository")
16
 */
17
class Layout
18
{
19
    /**
20
     * @ORM\Id()
21
     * @ORM\Column(type="string")
22
     * @var string
23
     */
24
    private $id;
25
26
    /**
27
     * @ORM\Column(type="boolean", name="is_default")
28
     * @Groups({"layout"})
29
     * @var bool
30
     */
31
    private $default = false;
32
33
    /**
34
     * @ORM\ManyToOne(targetEntity="Silverback\ApiComponentBundle\Entity\Layout\NavBar\NavBar")
35
     * @ORM\JoinColumn(onDelete="SET NULL")
36
     * @Groups({"layout", "default"})
37
     * @var null|NavBar
38
     */
39
    private $navBar;
40
41 1
    public function __construct()
42
    {
43 1
        $this->id = Uuid::uuid4()->getHex();
44 1
    }
45
46
    /**
47
     * @return string
48
     */
49
    public function getId(): string
50
    {
51
        return $this->id;
52
    }
53
54
    /**
55
     * @return bool
56
     */
57
    public function isDefault(): bool
58
    {
59
        return $this->default;
60
    }
61
62
    /**
63
     * @param bool $default
64
     */
65 1
    public function setDefault(bool $default): void
66
    {
67 1
        $this->default = $default;
68 1
    }
69
70
    /**
71
     * @return null|NavBar
72
     */
73
    public function getNavBar(): ?NavBar
74
    {
75
        return $this->navBar;
76
    }
77
78
    /**
79
     * @param null|NavBar $navBar
80
     */
81
    public function setNavBar(?NavBar $navBar): void
82
    {
83
        $this->navBar = $navBar;
84
    }
85
}
86