Completed
Push — master ( 1de9b7...830752 )
by Kristof
38:46 queued 24:09
created

src/Kunstmaan/SeoBundle/Entity/Seo.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Kunstmaan\SeoBundle\Entity;
4
5
use Doctrine\ORM\EntityManager;
6
use Doctrine\ORM\Mapping as ORM;
7
use Kunstmaan\AdminBundle\Entity\AbstractEntity;
8
use Kunstmaan\MediaBundle\Entity\Media;
9
use Kunstmaan\SeoBundle\Form\SeoType;
10
use Kunstmaan\UtilitiesBundle\Helper\ClassLookup;
11
12
/**
13
 * Seo metadata for entities
14
 *
15
 * @ORM\Entity(repositoryClass="Kunstmaan\SeoBundle\Repository\SeoRepository")
16
 * @ORM\Table(name="kuma_seo", indexes={@ORM\Index(name="idx_seo_lookup", columns={"ref_id", "ref_entity_name"})})
17
 * @ORM\ChangeTrackingPolicy("DEFERRED_EXPLICIT")
18
 */
19
class Seo extends AbstractEntity
20
{
21
    /**
22
     * @var string
23
     *
24
     * @ORM\Column(name="meta_title", type="string", nullable=true)
25
     */
26
    protected $metaTitle;
27
28
    /**
29
     * @var string
30
     *
31
     * @ORM\Column(name="meta_description", type="text", nullable=true)
32
     */
33
    protected $metaDescription;
34
35
    /**
36
     * @var string
37
     *
38
     * @ORM\Column(name="meta_author", type="string", nullable=true)
39
     */
40
    protected $metaAuthor;
41
42
    /**
43
     * @var string
44
     *
45
     * @ORM\Column(name="meta_robots", type="string", nullable=true)
46
     */
47
    protected $metaRobots;
48
49
    /**
50
     * @var string
51
     *
52
     * @ORM\Column(name="og_type", type="string", nullable=true)
53
     */
54
    protected $ogType;
55
56
    /**
57
     * @var string
58
     *
59
     * @ORM\Column(name="og_title", type="string", nullable=true)
60
     */
61
    protected $ogTitle;
62
63
    /**
64
     * @var string
65
     *
66
     * @ORM\Column(name="og_description", type="text", nullable=true)
67
     */
68
    protected $ogDescription;
69
70
    /**
71
     * @var Media
72
     *
73
     * @ORM\ManyToOne(targetEntity="Kunstmaan\MediaBundle\Entity\Media")
74
     * @ORM\JoinColumn(name="og_image_id", referencedColumnName="id")
75
     */
76
    protected $ogImage;
77
78
    /**
79
     * @var string
80
     *
81
     * @ORM\Column(name="extra_metadata", type="text", nullable=true)
82
     */
83
    protected $extraMetadata;
84
85
    /**
86
     * @var int
87
     *
88
     * @ORM\Column(type="bigint", name="ref_id")
89
     */
90
    protected $refId;
91
92
    /**
93
     * @var string
94
     *
95
     * @ORM\Column(type="string", name="ref_entity_name")
96
     */
97
    protected $refEntityName;
98
99
    /**
100
     * @ORM\Column(type="string", nullable=true, name="og_url")
101
     */
102
    protected $ogUrl;
103
104
    /**
105
     * @ORM\Column(type="string", length=100, nullable=true, name="og_article_author")
106
     */
107
    protected $ogArticleAuthor;
108
109
    /**
110
     * @ORM\Column(type="string", length=100, nullable=true, name="og_article_publisher")
111
     */
112
    protected $ogArticlePublisher;
113
114
    /**
115
     * @ORM\Column(type="string", length=100, nullable=true, name="og_article_section")
116
     */
117
    protected $ogArticleSection;
118
119
    /**
120
     * @var string
121
     *
122
     * @ORM\Column(name="twitter_title", type="string", length=255, nullable=true)
123
     */
124
    protected $twitterTitle;
125
126
    /**
127
     * @var string
128
     *
129
     * @ORM\Column(name="twitter_description", type="text", nullable=true)
130
     */
131
    protected $twitterDescription;
132
133
    /**
134
     * @var string
135
     *
136
     * @ORM\Column(name="twitter_site", type="string", length=255, nullable=true)
137
     */
138
    protected $twitterSite;
139
140
    /**
141
     * @var string
142
     *
143
     * @ORM\Column(name="twitter_creator", type="string", length=255, nullable=true)
144
     */
145
    protected $twitterCreator;
146
147
    /**
148
     * @var Media
149
     *
150
     * @ORM\ManyToOne(targetEntity="Kunstmaan\MediaBundle\Entity\Media")
151
     * @ORM\JoinColumn(name="twitter_image_id", referencedColumnName="id")
152
     */
153
    protected $twitterImage;
154
155
    /**
156
     * @param string $url
157
     *
158
     * @return Seo
159
     */
160
    public function setOgUrl($url)
161
    {
162
        $this->ogUrl = $url;
163
164
        return $this;
165
    }
166
167
    /**
168
     * @return string
169
     */
170
    public function getOgUrl()
171
    {
172
        return $this->ogUrl;
173
    }
174
175
    /**
176
     * @return string
177
     */
178
    public function getMetaTitle()
179
    {
180
        return $this->metaTitle;
181
    }
182
183
    /**
184
     * @param string $title
185
     *
186
     * @return string
0 ignored issues
show
Should the return type not be Seo?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
187
     */
188
    public function setMetaTitle($title)
189
    {
190
        $this->metaTitle = $title;
191
192
        return $this;
193
    }
194
195
    /**
196
     * @return string
197
     */
198
    public function getMetaAuthor()
199
    {
200
        return $this->metaAuthor;
201
    }
202
203
    /**
204
     * @param string $meta
205
     *
206
     * @return Seo
207
     */
208
    public function setMetaAuthor($meta)
209
    {
210
        $this->metaAuthor = $meta;
211
212
        return $this;
213
    }
214
215
    /**
216
     * @return string
217
     */
218
    public function getMetaDescription()
219
    {
220
        return $this->metaDescription;
221
    }
222
223
    /**
224
     * @param string $meta
225
     *
226
     * @return Seo
227
     */
228
    public function setMetaDescription($meta)
229
    {
230
        $this->metaDescription = $meta;
231
232
        return $this;
233
    }
234
235
    /**
236
     * @return string
237
     */
238
    public function getMetaRobots()
239
    {
240
        return $this->metaRobots;
241
    }
242
243
    /**
244
     * @param string $meta
245
     *
246
     * @return Seo
247
     */
248
    public function setMetaRobots($meta)
249
    {
250
        $this->metaRobots = $meta;
251
252
        return $this;
253
    }
254
255
    /**
256
     * @return string
257
     */
258
    public function getExtraMetadata()
259
    {
260
        return $this->extraMetadata;
261
    }
262
263
    /**
264
     * @param string $extraMetadata
265
     *
266
     * @return Seo
267
     */
268
    public function setExtraMetadata($extraMetadata)
269
    {
270
        $this->extraMetadata = $extraMetadata;
271
272
        return $this;
273
    }
274
275
    /**
276
     * @param string $ogDescription
277
     *
278
     * @return Seo
279
     */
280
    public function setOgDescription($ogDescription)
281
    {
282
        $this->ogDescription = $ogDescription;
283
284
        return $this;
285
    }
286
287
    /**
288
     * @return mixed
289
     */
290
    public function getOgDescription()
291
    {
292
        return $this->ogDescription;
293
    }
294
295
    /**
296
     * @param Media $ogImage
297
     *
298
     * @return Seo
299
     */
300
    public function setOgImage(Media $ogImage = null)
301
    {
302
        $this->ogImage = $ogImage;
303
304
        return $this;
305
    }
306
307
    /**
308
     * @return mixed
309
     */
310
    public function getOgImage()
311
    {
312
        return $this->ogImage;
313
    }
314
315
    /**
316
     * @param string $ogTitle
317
     *
318
     * @return Seo
319
     */
320
    public function setOgTitle($ogTitle)
321
    {
322
        $this->ogTitle = $ogTitle;
323
324
        return $this;
325
    }
326
327
    /**
328
     * @return mixed
329
     */
330
    public function getOgTitle()
331
    {
332
        return $this->ogTitle;
333
    }
334
335
    /**
336
     * @param string $ogType
337
     *
338
     * @return Seo
339
     */
340
    public function setOgType($ogType)
341
    {
342
        $this->ogType = $ogType;
343
344
        return $this;
345
    }
346
347
    /**
348
     * @return mixed
349
     */
350
    public function getOgType()
351
    {
352
        return $this->ogType;
353
    }
354
355
    /**
356
     * @return mixed
357
     */
358
    public function getOgArticleAuthor()
359
    {
360
        return $this->ogArticleAuthor;
361
    }
362
363
    /**
364
     * @param mixed $ogArticleAuthor
365
     */
366
    public function setOgArticleAuthor($ogArticleAuthor)
367
    {
368
        $this->ogArticleAuthor = $ogArticleAuthor;
369
    }
370
371
    /**
372
     * @return mixed
373
     */
374
    public function getOgArticlePublisher()
375
    {
376
        return $this->ogArticlePublisher;
377
    }
378
379
    /**
380
     * @param mixed $ogArticlePublisher
381
     */
382
    public function setOgArticlePublisher($ogArticlePublisher)
383
    {
384
        $this->ogArticlePublisher = $ogArticlePublisher;
385
    }
386
387
    /**
388
     * @return mixed
389
     */
390
    public function getOgArticleSection()
391
    {
392
        return $this->ogArticleSection;
393
    }
394
395
    /**
396
     * @param mixed $ogArticleSection
397
     */
398
    public function setOgArticleSection($ogArticleSection)
399
    {
400
        $this->ogArticleSection = $ogArticleSection;
401
    }
402
403
    /**
404
     * @return string
405
     */
406
    public function getTwitterTitle()
407
    {
408
        return $this->twitterTitle;
409
    }
410
411
    /**
412
     * @param string $twitterTitle
413
     */
414
    public function setTwitterTitle($twitterTitle)
415
    {
416
        $this->twitterTitle = $twitterTitle;
417
    }
418
419
    /**
420
     * @return string
421
     */
422
    public function getTwitterDescription()
423
    {
424
        return $this->twitterDescription;
425
    }
426
427
    /**
428
     * @param string $twitterDescription
429
     */
430
    public function setTwitterDescription($twitterDescription)
431
    {
432
        $this->twitterDescription = $twitterDescription;
433
    }
434
435
    /**
436
     * @return string
437
     */
438
    public function getTwitterSite()
439
    {
440
        return $this->twitterSite;
441
    }
442
443
    /**
444
     * @param string $twitterSite
445
     */
446
    public function setTwitterSite($twitterSite)
447
    {
448
        $this->twitterSite = $twitterSite;
449
    }
450
451
    /**
452
     * @return string
453
     */
454
    public function getTwitterCreator()
455
    {
456
        return $this->twitterCreator;
457
    }
458
459
    /**
460
     * @param string $twitterCreator
461
     */
462
    public function setTwitterCreator($twitterCreator)
463
    {
464
        $this->twitterCreator = $twitterCreator;
465
    }
466
467
    /**
468
     * @return Media
469
     */
470
    public function getTwitterImage()
471
    {
472
        return $this->twitterImage;
473
    }
474
475
    /**
476
     * @param Media $twitterImage
477
     */
478
    public function setTwitterImage($twitterImage)
479
    {
480
        $this->twitterImage = $twitterImage;
481
    }
482
483
    /**
484
     * Get refId
485
     *
486
     * @return int
487
     */
488
    public function getRefId()
489
    {
490
        return $this->refId;
491
    }
492
493
    /**
494
     * Set refId
495
     *
496
     * @param int $refId
497
     *
498
     * @return Seo
499
     */
500
    protected function setRefId($refId)
501
    {
502
        $this->refId = $refId;
503
504
        return $this;
505
    }
506
507
    /**
508
     * Set reference entity name
509
     *
510
     * @param string $refEntityName
511
     *
512
     * @return Seo
513
     */
514
    protected function setRefEntityName($refEntityName)
515
    {
516
        $this->refEntityName = $refEntityName;
517
518
        return $this;
519
    }
520
521
    /**
522
     * Get reference entity name
523
     *
524
     * @return string
525
     */
526
    public function getRefEntityName()
527
    {
528
        return $this->refEntityName;
529
    }
530
531
    /**
532
     * @param AbstractEntity $entity
533
     *
534
     * @return Seo
535
     */
536
    public function setRef(AbstractEntity $entity)
537
    {
538
        $this->setRefId($entity->getId());
539
        $this->setRefEntityName(ClassLookup::getClass($entity));
540
541
        return $this;
542
    }
543
544
    /**
545
     * @param EntityManager $em
546
     *
547
     * @return AbstractEntity
548
     */
549
    public function getRef(EntityManager $em)
550
    {
551
        return $em->getRepository($this->getRefEntityName())->find($this->getRefId());
552
    }
553
554
    /**
555
     * @return string
556
     */
557
    public function getDefaultAdminType()
558
    {
559
        return SeoType::class;
560
    }
561
}
562