Test Failed
Push — develop ( 92c10d...ff12cf )
by Daniel
05:05
created

DynamicContent::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Silverback\ApiComponentBundle\Entity\Content\Page\Dynamic;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
use Doctrine\Common\Collections\Collection;
7
use Doctrine\ORM\Mapping as ORM;
8
use Ramsey\Uuid\Uuid;
9
use Silverback\ApiComponentBundle\Entity\Content\Page\DynamicPage;
10
use Silverback\ApiComponentBundle\Entity\Route\Route;
11
use Symfony\Component\Serializer\Annotation\Groups;
12
13
/**
14
 * @ORM\Entity()
15
 * @ORM\InheritanceType("JOINED")
16
 * @ORM\DiscriminatorMap({
17
 *     "article_page" = "Silverback\ApiComponentBundle\Entity\Content\Page\Dynamic\ArticlePage\ArticlePage"
18
 * })
19
 */
20
abstract class DynamicContent extends DynamicContentBase
21
{
22
    /**
23
     * @ORM\OneToMany(targetEntity="Silverback\ApiComponentBundle\Entity\Route\Route", mappedBy="dynamicContent", cascade={"persist"})
24
     */
25
    protected $routes;
26
27
    /**
28
     * @ORM\Id()
29
     * @ORM\Column(type="string")
30
     * @var string
31
     */
32
    protected $id;
33
34
    /**
35
     * @var DynamicPage|null
36
     * @Groups({"content", "route", "component"})
37
     */
38
    private $dynamicPage;
39
40
    public function __construct()
41
    {
42
        $this->id = Uuid::uuid4()->getHex();
43
        $this->title = 'New dynamic page';
44
        $this->routes = new ArrayCollection;
45
    }
46
47
    public function getId(): string
48
    {
49
        return $this->id;
50
    }
51
52
    public function getDynamicPage(): ?DynamicPage
53
    {
54
        return $this->dynamicPage;
55
    }
56
57
    public function setDynamicPage(?DynamicPage $dynamicPage): void
58
    {
59
        $this->dynamicPage = $dynamicPage;
60
    }
61
62
    public function getParentRoute(): ?Route
63
    {
64
        return null;
65
    }
66
67
    public function getSortCollection(): ?Collection
68
    {
69
        return null;
70
    }
71
}
72