1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Kunstmaan\NodeBundle\Event; |
4
|
|
|
|
5
|
|
|
use Kunstmaan\NodeBundle\Entity\HasNodeInterface; |
6
|
|
|
use Kunstmaan\NodeBundle\Entity\Node; |
7
|
|
|
use Kunstmaan\NodeBundle\Entity\NodeTranslation; |
8
|
|
|
use Kunstmaan\NodeBundle\Entity\NodeVersion; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* CopyPageTranslationNodeEvent |
12
|
|
|
*/ |
13
|
|
View Code Duplication |
class CopyPageTranslationNodeEvent extends NodeEvent |
|
|
|
|
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* @var NodeTranslation |
17
|
|
|
*/ |
18
|
|
|
private $originalNodeTranslation; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @var HasNodeInterface |
22
|
|
|
*/ |
23
|
|
|
private $originalPage; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @var string |
27
|
|
|
*/ |
28
|
|
|
private $originalLanguage; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @var NodeVersion |
32
|
|
|
*/ |
33
|
|
|
private $originalNodeVersion; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @param Node $node The node |
37
|
|
|
* @param NodeTranslation $nodeTranslation The node translation |
38
|
|
|
* @param NodeVersion $nodeVersion The node version |
39
|
|
|
* @param HasNodeInterface $page The object |
40
|
|
|
* @param NodeTranslation $originalNodeTranslation The original node translation |
41
|
|
|
* @param NodeVersion $originalNodeVersion The original node version |
42
|
|
|
* @param HasNodeInterface $originalPage The original page |
43
|
|
|
* @param string $originalLanguage The original language |
44
|
|
|
*/ |
45
|
2 |
|
public function __construct(Node $node, NodeTranslation $nodeTranslation, NodeVersion $nodeVersion, HasNodeInterface $page, NodeTranslation $originalNodeTranslation, NodeVersion $originalNodeVersion, HasNodeInterface $originalPage, $originalLanguage) |
46
|
|
|
{ |
47
|
2 |
|
parent::__construct($node, $nodeTranslation, $nodeVersion, $page); |
48
|
2 |
|
$this->originalNodeTranslation = $originalNodeTranslation; |
49
|
2 |
|
$this->originalPage = $originalPage; |
50
|
2 |
|
$this->originalLanguage = $originalLanguage; |
51
|
2 |
|
$this->originalNodeVersion = $originalNodeVersion; |
52
|
2 |
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @param string $originalLanguage |
56
|
|
|
* |
57
|
|
|
* @return CopyPageTranslationNodeEvent |
58
|
|
|
*/ |
59
|
1 |
|
public function setOriginalLanguage($originalLanguage) |
60
|
|
|
{ |
61
|
1 |
|
$this->originalLanguage = $originalLanguage; |
62
|
|
|
|
63
|
1 |
|
return $this; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @return string |
68
|
|
|
*/ |
69
|
1 |
|
public function getOriginalLanguage() |
70
|
|
|
{ |
71
|
1 |
|
return $this->originalLanguage; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @param NodeTranslation $originalNodeTranslation |
76
|
|
|
* |
77
|
|
|
* @return CopyPageTranslationNodeEvent |
78
|
|
|
*/ |
79
|
1 |
|
public function setOriginalNodeTranslation($originalNodeTranslation) |
80
|
|
|
{ |
81
|
1 |
|
$this->originalNodeTranslation = $originalNodeTranslation; |
82
|
|
|
|
83
|
1 |
|
return $this; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @return NodeTranslation |
88
|
|
|
*/ |
89
|
1 |
|
public function getOriginalNodeTranslation() |
90
|
|
|
{ |
91
|
1 |
|
return $this->originalNodeTranslation; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* @param HasNodeInterface $originalPage |
96
|
|
|
* |
97
|
|
|
* @return CopyPageTranslationNodeEvent |
98
|
|
|
*/ |
99
|
1 |
|
public function setOriginalPage($originalPage) |
100
|
|
|
{ |
101
|
1 |
|
$this->originalPage = $originalPage; |
102
|
|
|
|
103
|
1 |
|
return $this; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @return HasNodeInterface |
108
|
|
|
*/ |
109
|
1 |
|
public function getOriginalPage() |
110
|
|
|
{ |
111
|
1 |
|
return $this->originalPage; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* @param NodeVersion $originalNodeVersion |
116
|
|
|
* |
117
|
|
|
* @return CopyPageTranslationNodeEvent |
118
|
|
|
*/ |
119
|
1 |
|
public function setOriginalNodeVersion($originalNodeVersion) |
120
|
|
|
{ |
121
|
1 |
|
$this->originalNodeVersion = $originalNodeVersion; |
122
|
|
|
|
123
|
1 |
|
return $this; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* @return NodeVersion |
128
|
|
|
*/ |
129
|
1 |
|
public function getOriginalNodeVersion() |
130
|
|
|
{ |
131
|
1 |
|
return $this->originalNodeVersion; |
132
|
|
|
} |
133
|
|
|
} |
134
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.