1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace JoppeDc\SyliusBetterSeoPlugin\Entity; |
6
|
|
|
|
7
|
|
|
use Sylius\Component\Core\Model\ProductTranslationInterface; |
8
|
|
|
use Sylius\Component\Product\Model\ProductInterface; |
9
|
|
|
use Sylius\Component\Resource\Model\ResourceInterface; |
10
|
|
|
use Sylius\Component\Resource\Model\TranslatableInterface; |
11
|
|
|
use Sylius\Component\Resource\Model\TranslatableTrait; |
12
|
|
|
use Sylius\Component\Resource\Model\TranslationInterface; |
13
|
|
|
|
14
|
|
|
class ProductSeo implements TranslatableInterface, ResourceInterface |
15
|
|
|
{ |
16
|
|
|
use TranslatableTrait { |
17
|
|
|
__construct as private initializeTranslationsCollection; |
18
|
|
|
getTranslation as private doGetTranslation; |
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @var int |
23
|
|
|
*/ |
24
|
|
|
protected $id; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @var ProductInterface |
28
|
|
|
*/ |
29
|
|
|
private $product; |
30
|
|
|
|
31
|
|
|
public function __construct() |
32
|
|
|
{ |
33
|
|
|
$this->initializeTranslationsCollection(); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
public function __toString() |
37
|
|
|
{ |
38
|
|
|
return (string) $this->getId(); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
public function getPageTitle(): ?string |
42
|
|
|
{ |
43
|
|
|
return $this->getTranslation()->getPageTitle(); |
|
|
|
|
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
public function setPageTitle(?string $pageTitle): void |
47
|
|
|
{ |
48
|
|
|
$this->getTranslation()->setPageTitle($pageTitle); |
|
|
|
|
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
public function getOgTitle(): ?string |
52
|
|
|
{ |
53
|
|
|
return $this->getTranslation()->getOgTitle(); |
|
|
|
|
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
public function setOgTitle(?string $ogTitle): void |
57
|
|
|
{ |
58
|
|
|
$this->getTranslation()->setOgTitle($ogTitle); |
|
|
|
|
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
public function getOgDescription(): ?string |
62
|
|
|
{ |
63
|
|
|
return $this->getTranslation()->getOgDescription(); |
|
|
|
|
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
public function setOgDescription(?string $ogDescription): void |
67
|
|
|
{ |
68
|
|
|
$this->getTranslation()->setOgDescription($ogDescription); |
|
|
|
|
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
public function getTwitterTitle(): ?string |
72
|
|
|
{ |
73
|
|
|
return $this->getTranslation()->getTwitterTitle(); |
|
|
|
|
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
public function setTwitterTitle(?string $twitterTitle): void |
77
|
|
|
{ |
78
|
|
|
$this->getTranslation()->setTwitterTitle($twitterTitle); |
|
|
|
|
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
public function getTwitterDescription(): ?string |
82
|
|
|
{ |
83
|
|
|
return $this->getTranslation()->getTwitterDescription(); |
|
|
|
|
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
public function setTwitterDescription(?string $twitterDescription): void |
87
|
|
|
{ |
88
|
|
|
$this->getTranslation()->setTwitterDescription($twitterDescription); |
|
|
|
|
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
public function getTwitterSite(): ?string |
92
|
|
|
{ |
93
|
|
|
return $this->getTranslation()->getTwitterSite(); |
|
|
|
|
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
public function setTwitterSite(?string $twitterSite): void |
97
|
|
|
{ |
98
|
|
|
$this->getTranslation()->setTwitterSite($twitterSite); |
|
|
|
|
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
public function getExtraTags(): ?string |
102
|
|
|
{ |
103
|
|
|
return $this->getTranslation()->getExtraTags(); |
|
|
|
|
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
public function setExtraTags(?string $extraTags): void |
107
|
|
|
{ |
108
|
|
|
$this->getTranslation()->setExtraTags($extraTags); |
|
|
|
|
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
public function getId() |
112
|
|
|
{ |
113
|
|
|
return $this->id; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
public function setId(?int $id): void |
117
|
|
|
{ |
118
|
|
|
$this->id = $id; |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* @return ProductSeoTranslation |
123
|
|
|
*/ |
124
|
|
|
public function getTranslation(?string $locale = null): TranslationInterface |
125
|
|
|
{ |
126
|
|
|
/** @var ProductTranslationInterface $translation */ |
127
|
|
|
$translation = $this->doGetTranslation($locale); |
128
|
|
|
|
129
|
|
|
return $translation; |
|
|
|
|
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
public function getProduct(): ?ProductInterface |
133
|
|
|
{ |
134
|
|
|
return $this->product; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
public function setProduct(?ProductInterface $product): void |
138
|
|
|
{ |
139
|
|
|
$this->product = $product; |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
protected function createTranslation(): ProductSeoTranslation |
143
|
|
|
{ |
144
|
|
|
return new ProductSeoTranslation(); |
145
|
|
|
} |
146
|
|
|
} |
147
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.