|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace eZ\Publish\Core\Event\Content; |
|
6
|
|
|
|
|
7
|
|
|
use eZ\Publish\API\Repository\Values\Content\Content; |
|
8
|
|
|
use eZ\Publish\API\Repository\Values\Content\ContentInfo; |
|
9
|
|
|
use eZ\Publish\API\Repository\Values\Content\LocationCreateStruct; |
|
10
|
|
|
use eZ\Publish\API\Repository\Values\Content\VersionInfo; |
|
11
|
|
|
use eZ\Publish\Core\Event\BeforeEvent; |
|
12
|
|
|
|
|
13
|
|
|
final class BeforeCopyContentEvent extends BeforeEvent |
|
14
|
|
|
{ |
|
15
|
|
|
public const NAME = 'ezplatform.event.content.copy.before'; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* @var \eZ\Publish\API\Repository\Values\Content\ContentInfo |
|
19
|
|
|
*/ |
|
20
|
|
|
private $contentInfo; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* @var \eZ\Publish\API\Repository\Values\Content\LocationCreateStruct |
|
24
|
|
|
*/ |
|
25
|
|
|
private $destinationLocationCreateStruct; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* @var \eZ\Publish\API\Repository\Values\Content\VersionInfo |
|
29
|
|
|
*/ |
|
30
|
|
|
private $versionInfo; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @var \eZ\Publish\API\Repository\Values\Content\Content|null |
|
34
|
|
|
*/ |
|
35
|
|
|
private $content; |
|
36
|
|
|
|
|
37
|
|
|
|
|
38
|
|
|
public function __construct( |
|
39
|
|
|
ContentInfo $contentInfo, |
|
40
|
|
|
LocationCreateStruct $destinationLocationCreateStruct, |
|
41
|
|
|
VersionInfo $versionInfo |
|
42
|
|
|
) { |
|
43
|
|
|
$this->contentInfo = $contentInfo; |
|
44
|
|
|
$this->destinationLocationCreateStruct = $destinationLocationCreateStruct; |
|
45
|
|
|
$this->versionInfo = $versionInfo; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
|
|
49
|
|
|
public function getContentInfo(): ContentInfo |
|
50
|
|
|
{ |
|
51
|
|
|
return $this->contentInfo; |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
|
|
55
|
|
|
public function getDestinationLocationCreateStruct(): LocationCreateStruct |
|
56
|
|
|
{ |
|
57
|
|
|
return $this->destinationLocationCreateStruct; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
|
|
61
|
|
|
public function getVersionInfo(): VersionInfo |
|
62
|
|
|
{ |
|
63
|
|
|
return $this->versionInfo; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
|
|
67
|
|
|
function getContent(): ?Content |
|
|
|
|
|
|
68
|
|
|
{ |
|
69
|
|
|
return $this->content; |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
|
|
73
|
|
|
function setContent(?Content $content): void |
|
|
|
|
|
|
74
|
|
|
{ |
|
75
|
|
|
$this->content = $content; |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
|
|
79
|
|
|
function hasContent(): bool |
|
|
|
|
|
|
80
|
|
|
{ |
|
81
|
|
|
return $this->content instanceof Content; |
|
82
|
|
|
} |
|
83
|
|
|
} |
|
84
|
|
|
|
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.