Completed
Push — master ( 6e6249...28ec7c )
by Benjamin
23:40 queued 02:04
created

Node   A

Complexity

Total Complexity 26

Size/Duplication

Total Lines 371
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Importance

Changes 4
Bugs 1 Features 0
Metric Value
wmc 26
c 4
b 1
f 0
lcom 2
cbo 0
dl 0
loc 371
rs 10

26 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getUriParameters() 0 7 1
A getPlaceholders() 0 7 1
A __toString() 0 4 1
A getId() 0 4 1
A setId() 0 6 1
A getTitle() 0 4 1
A setTitle() 0 6 1
A getContent() 0 4 1
A setContent() 0 6 1
A getDateCreated() 0 4 1
A setDateCreated() 0 6 1
A getDateUpdated() 0 4 1
A setDateUpdated() 0 6 1
A getPublished() 0 4 1
A setPublished() 0 6 1
A getWeight() 0 4 1
A setWeight() 0 6 1
A getSlug() 0 4 1
A setSlug() 0 6 1
A getType() 0 4 1
A setType() 0 6 1
A getLocale() 0 4 1
A setLocale() 0 6 1
A getTranslationSource() 0 4 1
A setTranslationSource() 0 6 1
1
<?php
2
3
namespace Alpixel\Bundle\CMSBundle\Entity;
4
5
use Alpixel\Bundle\SEOBundle\Entity\MetaTagPlaceholderInterface;
6
use Doctrine\ORM\Mapping as ORM;
7
use Gedmo\Mapping\Annotation as Gedmo;
8
9
/**
10
 * Page.
11
 *
12
 * @ORM\Table(name="cms_node")
13
 * @ORM\HasLifecycleCallbacks
14
 * @ORM\Entity(repositoryClass="Alpixel\Bundle\CMSBundle\Entity\Repository\NodeRepository")
15
 */
16
class Node implements MetaTagPlaceholderInterface
17
{
18
    /**
19
     * @var int
20
     *
21
     * @ORM\Column(name="node_id", type="integer")
22
     * @ORM\Id
23
     * @ORM\GeneratedValue(strategy="AUTO")
24
     */
25
    protected $id;
26
27
    /**
28
     * @var string
29
     *
30
     * @ORM\Column(name="locale", type="string", length=10, nullable=true)
31
     */
32
    protected $locale;
33
34
    /**
35
     * @var \Alpixel\Bundle\CMSBundle\Entity\Node
36
     *
37
     * @ORM\ManyToOne(targetEntity="Alpixel\Bundle\CMSBundle\Entity\Node")
38
     * @ORM\JoinColumn(name="translation_source_id",referencedColumnName="node_id", nullable=true, onDelete="SET NULL")
39
     */
40
    protected $translationSource;
41
42
    /**
43
     * @var string
44
     *
45
     * @ORM\Column(name="title", type="string", length=255, nullable=false)
46
     */
47
    protected $title;
48
49
    /**
50
     * @var string
51
     *
52
     * @ORM\Column(name="type", type="string", length=255, nullable=false)
53
     */
54
    protected $type;
55
56
    /**
57
     * @var string
58
     *
59
     * @ORM\Column(name="content", type="text", nullable=true)
60
     */
61
    protected $content;
62
63
    /**
64
     * @var \DateTime
65
     *
66
     * @Gedmo\Timestampable(on="create")
67
     * @ORM\Column(name="date_created", type="datetime", nullable=false)
68
     */
69
    protected $dateCreated;
70
71
    /**
72
     * @var \DateTime
73
     * @Gedmo\Timestampable(on="update")
74
     * @ORM\Column(name="date_updated", type="datetime", nullable=false)
75
     */
76
    protected $dateUpdated;
77
78
    /**
79
     * @var bool
80
     *
81
     * @ORM\Column(name="published", type="boolean", nullable=false, options={"default"= true})
82
     */
83
    protected $published;
84
85
    /**
86
     * @var int
87
     * @Gedmo\SortablePosition
88
     * @ORM\Column(name="weight", type="integer", nullable=false)
89
     */
90
    protected $weight;
91
92
    /**
93
     * @Gedmo\Slug(fields={"title"}, updatable=false, separator="_")
94
     * @ORM\Column(length=128, unique=true)
95
     **/
96
    protected $slug;
97
98
    public function __construct()
99
    {
100
    }
101
102
    public function getUriParameters()
103
    {
104
        return [
105
            'id'            => $this->id,
106
            'slug'          => $this->slug,
107
        ];
108
    }
109
110
    public function getPlaceholders()
111
    {
112
        return [
113
            '[cms:title]'  => $this->title,
114
            '[cms:resume]' => substr(strip_tags($this->content), 0, 150),
115
        ];
116
    }
117
118
    public function __toString()
119
    {
120
        return $this->title;
121
    }
122
123
    /**
124
     * Gets the value of id.
125
     *
126
     * @return int
127
     */
128
    public function getId()
129
    {
130
        return $this->id;
131
    }
132
133
    /**
134
     * Sets the value of id.
135
     *
136
     * @param int $id the id
137
     *
138
     * @return self
139
     */
140
    public function setId($id)
141
    {
142
        $this->id = $id;
143
144
        return $this;
145
    }
146
147
    /**
148
     * Gets the value of title.
149
     *
150
     * @return string
151
     */
152
    public function getTitle()
153
    {
154
        return $this->title;
155
    }
156
157
    /**
158
     * Sets the value of title.
159
     *
160
     * @param string $title the title
161
     *
162
     * @return self
163
     */
164
    public function setTitle($title)
165
    {
166
        $this->title = $title;
167
168
        return $this;
169
    }
170
171
    /**
172
     * Gets the value of content.
173
     *
174
     * @return string
175
     */
176
    public function getContent()
177
    {
178
        return $this->content;
179
    }
180
181
    /**
182
     * Sets the value of content.
183
     *
184
     * @param string $content the content
185
     *
186
     * @return self
187
     */
188
    public function setContent($content)
189
    {
190
        $this->content = $content;
191
192
        return $this;
193
    }
194
195
    /**
196
     * Gets the value of dateCreated.
197
     *
198
     * @return \DateTime
199
     */
200
    public function getDateCreated()
201
    {
202
        return $this->dateCreated;
203
    }
204
205
    /**
206
     * Sets the value of dateCreated.
207
     *
208
     * @param \DateTime $dateCreated the date created
209
     *
210
     * @return self
211
     */
212
    public function setDateCreated(\DateTime $dateCreated)
213
    {
214
        $this->dateCreated = $dateCreated;
215
216
        return $this;
217
    }
218
219
    /**
220
     * Gets the value of dateUpdated.
221
     *
222
     * @return \DateTime
223
     */
224
    public function getDateUpdated()
225
    {
226
        return $this->dateUpdated;
227
    }
228
229
    /**
230
     * Sets the value of dateUpdated.
231
     *
232
     * @param \DateTime $dateUpdated the date updated
233
     *
234
     * @return self
235
     */
236
    public function setDateUpdated(\DateTime $dateUpdated)
237
    {
238
        $this->dateUpdated = $dateUpdated;
239
240
        return $this;
241
    }
242
243
    /**
244
     * Gets the value of published.
245
     *
246
     * @return bool
247
     */
248
    public function getPublished()
249
    {
250
        return $this->published;
251
    }
252
253
    /**
254
     * Sets the value of published.
255
     *
256
     * @param bool $published the published
257
     *
258
     * @return self
259
     */
260
    public function setPublished($published)
261
    {
262
        $this->published = $published;
263
264
        return $this;
265
    }
266
267
    /**
268
     * Gets the value of weight.
269
     *
270
     * @return int
271
     */
272
    public function getWeight()
273
    {
274
        return $this->weight;
275
    }
276
277
    /**
278
     * Sets the value of weight.
279
     *
280
     * @param int $weight the weight
281
     *
282
     * @return self
283
     */
284
    public function setWeight($weight)
285
    {
286
        $this->weight = $weight;
287
288
        return $this;
289
    }
290
291
    /**
292
     * Gets the value of slug.
293
     *
294
     * @return mixed
295
     */
296
    public function getSlug()
297
    {
298
        return $this->slug;
299
    }
300
301
    /**
302
     * Sets the value of slug.
303
     *
304
     * @param mixed $slug the slug
305
     *
306
     * @return self
307
     */
308
    public function setSlug($slug)
309
    {
310
        $this->slug = $slug;
311
312
        return $this;
313
    }
314
315
    /**
316
     * Gets the value of type.
317
     *
318
     * @return string
319
     */
320
    public function getType()
321
    {
322
        return $this->type;
323
    }
324
325
    /**
326
     * Sets the value of type.
327
     *
328
     * @param string $type the type
329
     *
330
     * @return self
331
     */
332
    public function setType($type)
333
    {
334
        $this->type = $type;
335
336
        return $this;
337
    }
338
339
    /**
340
     * Gets the value of locale.
341
     *
342
     * @return string
343
     */
344
    public function getLocale()
345
    {
346
        return $this->locale;
347
    }
348
349
    /**
350
     * Sets the value of locale.
351
     *
352
     * @param string $locale the locale
353
     *
354
     * @return self
355
     */
356
    public function setLocale($locale)
357
    {
358
        $this->locale = $locale;
359
360
        return $this;
361
    }
362
363
    /**
364
     * Gets the value of translationSource.
365
     *
366
     * @return \Alpixel\Bundle\CMSBundle\Entity\Node
367
     */
368
    public function getTranslationSource()
369
    {
370
        return $this->translationSource;
371
    }
372
373
    /**
374
     * Sets the value of translationSource.
375
     *
376
     * @param \Alpixel\Bundle\CMSBundle\Entity\Node $translationSource the translation source
377
     *
378
     * @return self
379
     */
380
    public function setTranslationSource(\Alpixel\Bundle\CMSBundle\Entity\Node $translationSource)
381
    {
382
        $this->translationSource = $translationSource;
383
384
        return $this;
385
    }
386
}
387