Completed
Pull Request — 5.2 (#2400)
by
unknown
12:28
created

AbstractPage::isStructurePage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Kunstmaan\NodeBundle\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Kunstmaan\AdminBundle\Entity\AbstractEntity;
7
use Kunstmaan\NodeBundle\Form\PageAdminType;
8
use Kunstmaan\NodeBundle\Helper\RenderContext;
9
use Symfony\Component\DependencyInjection\ContainerInterface;
10
use Symfony\Component\HttpFoundation\Request;
11
use Symfony\Component\Validator\Constraints as Assert;
12
13
/**
14
 * The Abstract ORM Page
15
 */
16
abstract class AbstractPage extends AbstractEntity implements PageInterface
17
{
18
    /**
19
     * @var string
20
     *
21
     * @ORM\Column(type="string")
22
     * @Assert\NotBlank()
23
     */
24
    protected $title;
25
26
    /**
27
     * @var string
28
     *
29
     * @ORM\Column(type="string", nullable=true, name="page_title")
30
     */
31
    protected $pageTitle;
32
33
    /**
34
     * @var HasNodeInterface
35
     */
36
    protected $parent;
37
38
    /**
39
     * Set title
40
     *
41
     * @param string $title
42
     *
43
     * @return AbstractPage
44
     */
45
    public function setTitle($title)
46
    {
47
        $this->title = $title;
48
49
        return $this;
50
    }
51
52
    /**
53
     * Get title
54
     *
55
     * @return string
56
     */
57
    public function getTitle()
58
    {
59
        return $this->title;
60
    }
61
62
    /**
63
     * Set pagetitle
64
     *
65
     * @param string $pageTitle
66
     *
67
     * @return AbstractPage
68
     */
69
    public function setPageTitle($pageTitle)
70
    {
71
        $this->pageTitle = $pageTitle;
72
73
        return $this;
74
    }
75
76
    /**
77
     * Get pagetitle
78
     *
79
     * @return string
80
     */
81
    public function getPageTitle()
82
    {
83
        if (!empty($this->pageTitle)) {
84
            return $this->pageTitle;
85
        } else {
86
            return $this->getTitle();
87
        }
88
    }
89
90
    /**
91
     * @return HasNodeInterface
92
     */
93
    public function getParent()
94
    {
95
        return $this->parent;
96
    }
97
98
    /**
99
     * @param HasNodeInterface $parent
100
     *
101
     * @return AbstractPage
102
     */
103
    public function setParent(HasNodeInterface $parent)
104
    {
105
        $this->parent = $parent;
106
107
        return $this;
108
    }
109
110
    /**
111
     * @return string
112
     */
113
    public function __toString()
114
    {
115
        return $this->getTitle();
116
    }
117
118
    /**
119
     * {@inheritdoc}
120
     */
121
    public function getDefaultAdminType()
122
    {
123
        return PageAdminType::class;
124
    }
125
126
    /**
127
     * {@inheritdoc}
128
     *
129
     * @deprecated Using the service method is deprecated in KunstmaanNodeBundle 5.1 and will be removed in KunstmaanNodeBundle 6.0. Implement SlugActionInterface and use the getControllerAction method to provide custom logic instead.
130
     */
131
    public function service(ContainerInterface $container, Request $request, RenderContext $context)
132
    {
133
    }
134
135
    /**
136
     * By default this will return false. Pages will always be pages until some class says otherwise.
137
     *
138
     * {@inheritdoc}
139
     */
140
    public function isStructurePage()
141
    {
142
        return false;
143
    }
144
145
    /**
146
     * By default this will return false. Pages will always be pages until some class says otherwise.
147
     *
148
     * @deprecated Using the isStructureNode method is deprecated in KunstmaanNodeBundle 5.2 and will be removed in KunstmaanNodeBundle 6.0. use isStructurePage.
149
     */
150
    public function isStructureNode()
151
    {
152
        return false;
153
    }
154
}
155