Completed
Push — master ( 7c1165...cb0569 )
by Dev
13:37
created

PageExtendedTrait::removeRelatedPage()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 7
ccs 0
cts 4
cp 0
crap 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace PiedWeb\CMSBundle\Entity;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
use Doctrine\Common\Collections\Collection;
7
use Doctrine\ORM\Mapping as ORM;
8
use Gedmo\Mapping\Annotation as Gedmo;
9
10
/**
11
 * Page extended: // I may cut this in multiple traits
12
 * - meta no-index
13
 * - Rich Content (meta desc, parentPage, h1, name [to do short link] )
14
 * - author (link)
15
 * - template.
16
 */
17
trait PageExtendedTrait
18
{
19
    /**
20
     * @Gedmo\Translatable
21
     * @ORM\Column(type="string", length=255, nullable=true)
22
     */
23
    protected $excrept;
24
25
    /**
26
     * @Gedmo\Translatable
27
     * @ORM\Column(type="string", length=50, nullable=true)
28
     */
29
    protected $metaRobots;
30
31
    /**
32
     * @ORM\ManyToOne(targetEntity="PiedWeb\CMSBundle\Entity\PageInterface", inversedBy="childrenPages")
33
     */
34
    protected $parentPage;
35
36
    /**
37
     * @ORM\OneToMany(targetEntity="PiedWeb\CMSBundle\Entity\PageInterface", mappedBy="parentPage")
38
     */
39
    protected $childrenPages;
40
41
    /**
42
     * @Gedmo\Translatable
43
     * @ORM\Column(type="string", length=255, nullable=true)
44
     */
45
    protected $h1;
46
47
    /**
48
     * @Gedmo\Translatable
49
     * @ORM\Column(type="string", length=150, nullable=true)
50
     */
51
    protected $name;
52
53
    /**
54
     * @ORM\ManyToOne(targetEntity="PiedWeb\CMSBundle\Entity\UserInterface")
55
     */
56
    protected $author;
57
58
    /**
59
     * @ORM\Column(type="string", length=250, nullable=true)
60
     */
61
    protected $template;
62
63
    public function __constructExtended()
64
    {
65
        $this->relatedPages = new ArrayCollection();
0 ignored issues
show
Bug Best Practice introduced by
The property relatedPages does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
66
    }
67
68
    public function getExcrept(): ?string
69 3
    {
70
        return $this->excrept;
71 3
    }
72 3
73
    public function setExcrept(?string $excrept): self
74
    {
75
        $this->excrept = $excrept;
76
77
        return $this;
78
    }
79
80
    public function getMetaRobots(): ?string
81
    {
82
        return $this->metaRobots;
83
    }
84
85
    public function setMetaRobots(?string $metaRobots): self
86
    {
87
        $this->metaRobots = $metaRobots;
88
89
        return $this;
90
    }
91
92
    public function getParentPage(): ?self
93
    {
94
        return $this->parentPage;
95
    }
96
97
    public function setParentPage(?self $parentPage): self
98
    {
99
        $this->parentPage = $parentPage;
100
101
        return $this;
102
    }
103
104
    public function getChildrenPages()
105
    {
106
        return $this->childrenPages;
107
    }
108
109
    public function getH1(): ?string
110
    {
111
        return $this->h1;
112
    }
113
114
    public function setH1(?string $h1): self
115
    {
116
        $this->h1 = $h1;
117
118
        return $this;
119
    }
120
121
    public function getName(): ?string
122
    {
123
        return $this->name;
124
    }
125
126
    public function setName(?string $name): self
127
    {
128
        $this->name = $name;
129
130
        return $this;
131
    }
132
133
    public function getAuthor(): ?User
134
    {
135
        return $this->author;
136
    }
137
138
    public function setAuthor(?User $author): self
139
    {
140
        $this->author = $author;
141
142
        return $this;
143
    }
144
145
    public function getTemplate(): ?string
146
    {
147
        return $this->template;
148
    }
149
150
    public function setTemplate(?string $template): self
151
    {
152
        $this->template = $template;
153
154
        return $this;
155
    }
156
}
157