1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
|
4
|
|
|
/* |
5
|
|
|
* Copyright (C) |
6
|
|
|
* Nathan Boiron <[email protected]> |
7
|
|
|
* Romain Canon <[email protected]> |
8
|
|
|
* |
9
|
|
|
* This file is part of the TYPO3 NotiZ project. |
10
|
|
|
* It is free software; you can redistribute it and/or modify it |
11
|
|
|
* under the terms of the GNU General Public License, either |
12
|
|
|
* version 3 of the License, or any later version. |
13
|
|
|
* |
14
|
|
|
* For the full copyright and license information, see: |
15
|
|
|
* http://www.gnu.org/licenses/gpl-3.0.html |
16
|
|
|
*/ |
17
|
|
|
|
18
|
|
|
namespace CuyZ\Notiz\Domain\Event\TYPO3; |
19
|
|
|
|
20
|
|
|
use CuyZ\Notiz\Core\Event\AbstractEvent; |
21
|
|
|
use CuyZ\Notiz\Core\Event\Support\ProvidesExampleProperties; |
22
|
|
|
use InvalidArgumentException; |
23
|
|
|
use TYPO3\CMS\Backend\Utility\BackendUtility; |
|
|
|
|
24
|
|
|
use TYPO3\CMS\Core\DataHandling\DataHandler; |
25
|
|
|
|
26
|
|
|
final class RecordCreatedEvent extends AbstractEvent implements ProvidesExampleProperties |
27
|
|
|
{ |
28
|
|
|
/** |
29
|
|
|
* @label Event/TYPO3:record_created.marker.status |
30
|
|
|
* @marker |
31
|
|
|
* |
32
|
|
|
* @var string |
33
|
|
|
*/ |
34
|
|
|
protected $status; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @label Event/TYPO3:record_created.marker.table |
38
|
|
|
* @marker |
39
|
|
|
* |
40
|
|
|
* @var string |
41
|
|
|
*/ |
42
|
|
|
protected $table; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @label Event/TYPO3:record_created.marker.uid |
46
|
|
|
* @marker |
47
|
|
|
* |
48
|
|
|
* @var string |
49
|
|
|
*/ |
50
|
|
|
protected $uid; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @label Event/TYPO3:record_created.marker.record |
54
|
|
|
* @marker |
55
|
|
|
* |
56
|
|
|
* @var array |
57
|
|
|
*/ |
58
|
|
|
protected $record; |
59
|
|
|
|
60
|
|
|
public function run($status, $table, $recordId, array $updatedFields, DataHandler $dataHandler) |
61
|
|
|
{ |
62
|
|
|
if ($table !== $this->configuration['table']) { |
63
|
|
|
$this->cancelDispatch(); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
if ($status === 'new') { |
67
|
|
|
$this->uid = $dataHandler->substNEWwithIDs[$recordId]; |
68
|
|
|
$this->record = $updatedFields; |
69
|
|
|
} elseif ($status === 'update') { |
70
|
|
|
$this->uid = $recordId; |
71
|
|
|
$this->record = BackendUtility::getRecord($table, $recordId); |
72
|
|
|
} else { |
73
|
|
|
throw new InvalidArgumentException('$status must be `new` or `update`'); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
if ($table === 'tt_content' |
77
|
|
|
&& !empty($this->configuration['ctype']) |
78
|
|
|
&& !preg_match($this->configuration['ctype'], $this->record['CType']) |
79
|
|
|
) { |
80
|
|
|
$this->cancelDispatch(); |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
$this->status = $status; |
84
|
|
|
$this->table = $table; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
public function getExampleProperties(): array |
88
|
|
|
{ |
89
|
|
|
return [ |
90
|
|
|
'status' => 'new', |
91
|
|
|
'table' => $this->configuration['table'], |
92
|
|
|
'uid' => 1337, |
93
|
|
|
'record' => [ |
94
|
|
|
'uid' => 1337, |
95
|
|
|
'pid' => 42, |
96
|
|
|
'starttime' => 1612014706, |
97
|
|
|
], |
98
|
|
|
]; |
99
|
|
|
} |
100
|
|
|
} |
101
|
|
|
|
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