|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace App\Domain\Book\Event; |
|
6
|
|
|
|
|
7
|
|
|
use App\Domain\Book\ValueObject\Description; |
|
8
|
|
|
use App\Domain\Common\ValueObject\AggregateRootId; |
|
9
|
|
|
use App\Domain\Common\ValueObject\Name; |
|
10
|
|
|
use Prooph\EventSourcing\AggregateChanged; |
|
|
|
|
|
|
11
|
|
|
|
|
12
|
|
|
final class BookWasCreated extends AggregateChanged |
|
13
|
|
|
{ |
|
14
|
|
|
/** |
|
15
|
|
|
* @var AggregateRootId |
|
16
|
|
|
*/ |
|
17
|
|
|
private $id; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* @var Name |
|
21
|
|
|
*/ |
|
22
|
|
|
private $name; |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* @var Description |
|
26
|
|
|
*/ |
|
27
|
|
|
private $description; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* @var string |
|
31
|
|
|
*/ |
|
32
|
|
|
private $category; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* @var string |
|
36
|
|
|
*/ |
|
37
|
|
|
private $author; |
|
38
|
|
|
|
|
39
|
|
|
public static function createWithData(AggregateRootId $id, Name $name, Description $description, string $category, string $author): self |
|
40
|
|
|
{ |
|
41
|
|
|
/** @var self $event */ |
|
42
|
|
|
$event = self::occur($id->toString(), [ |
|
43
|
|
|
'name' => $name->toString(), |
|
44
|
|
|
'description' => $description->toString(), |
|
45
|
|
|
'category' => $category, |
|
46
|
|
|
'author' => $author, |
|
47
|
|
|
]); |
|
48
|
|
|
|
|
49
|
|
|
$event->id = $id; |
|
50
|
|
|
$event->name = $name; |
|
51
|
|
|
$event->description = $description; |
|
52
|
|
|
$event->author = $author; |
|
53
|
|
|
$event->category = $category; |
|
54
|
|
|
|
|
55
|
|
|
return $event; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
public function getId(): AggregateRootId |
|
59
|
|
|
{ |
|
60
|
|
|
if (null === $this->id) { |
|
61
|
|
|
$this->id = AggregateRootId::fromString($this->aggregateId()); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
return $this->id; |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
public function getName(): Name |
|
68
|
|
|
{ |
|
69
|
|
|
if (null === $this->name) { |
|
70
|
|
|
$this->name = Name::fromString($this->payload['name']); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
return $this->name; |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
public function getDescription(): Description |
|
77
|
|
|
{ |
|
78
|
|
|
if (null === $this->description) { |
|
79
|
|
|
$this->description = Description::fromString($this->payload['description']); |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
return $this->description; |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* @return string |
|
87
|
|
|
*/ |
|
88
|
|
|
public function getCategory(): string |
|
89
|
|
|
{ |
|
90
|
|
|
if (null === $this->category) { |
|
91
|
|
|
$this->category = $this->payload['category']; |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
return $this->category; |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* @return string |
|
99
|
|
|
*/ |
|
100
|
|
|
public function getAuthor(): string |
|
101
|
|
|
{ |
|
102
|
|
|
if (null === $this->author) { |
|
103
|
|
|
$this->author = $this->payload['author']; |
|
104
|
|
|
} |
|
105
|
|
|
|
|
106
|
|
|
return $this->author; |
|
107
|
|
|
} |
|
108
|
|
|
} |
|
109
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths