|
@@ -36,7 +36,7 @@ discard block |
|
|
block discarded – undo |
|
36
|
36
|
{ |
|
37
|
37
|
parent::registerAuditingService($service); |
|
38
|
38
|
|
|
39
|
|
- \assert($service instanceof AuditingService); // helps PHPStan |
|
|
39
|
+ \assert($service instanceof AuditingService); // helps PHPStan |
|
40
|
40
|
$entityManager = $service->getEntityManager(); |
|
41
|
41
|
$evm = $entityManager->getEventManager(); |
|
42
|
42
|
|
|
@@ -53,7 +53,7 @@ discard block |
|
|
block discarded – undo |
|
53
|
53
|
{ |
|
54
|
54
|
parent::registerStorageService($service); |
|
55
|
55
|
|
|
56
|
|
- \assert($service instanceof StorageService); // helps PHPStan |
|
|
56
|
+ \assert($service instanceof StorageService); // helps PHPStan |
|
57
|
57
|
$entityManager = $service->getEntityManager(); |
|
58
|
58
|
$evm = $entityManager->getEventManager(); |
|
59
|
59
|
|
|
@@ -72,7 +72,7 @@ discard block |
|
|
block discarded – undo |
|
72
|
72
|
{ |
|
73
|
73
|
$this->checkStorageMapper(); |
|
74
|
74
|
|
|
75
|
|
- \assert($this->configuration instanceof Configuration); // helps PHPStan |
|
|
75
|
+ \assert($this->configuration instanceof Configuration); // helps PHPStan |
|
76
|
76
|
$storageMapper = $this->configuration->getStorageMapper(); |
|
77
|
77
|
|
|
78
|
78
|
if (null === $storageMapper || 1 === \count($this->getStorageServices())) { |
|
@@ -131,7 +131,7 @@ discard block |
|
|
block discarded – undo |
|
131
|
131
|
{ |
|
132
|
132
|
$class = DoctrineHelper::getRealClassName($entity); |
|
133
|
133
|
// is $entity part of audited entities? |
|
134
|
|
- \assert($this->configuration instanceof Configuration); // helps PHPStan |
|
|
134
|
+ \assert($this->configuration instanceof Configuration); // helps PHPStan |
|
135
|
135
|
if (!\array_key_exists($class, $this->configuration->getEntities())) { |
|
136
|
136
|
// no => $entity is not audited |
|
137
|
137
|
return false; |
|
@@ -183,7 +183,7 @@ discard block |
|
|
block discarded – undo |
|
183
|
183
|
public function isAuditedField($entity, string $field): bool |
|
184
|
184
|
{ |
|
185
|
185
|
// is $field is part of globally ignored columns? |
|
186
|
|
- \assert($this->configuration instanceof Configuration); // helps PHPStan |
|
|
186
|
+ \assert($this->configuration instanceof Configuration); // helps PHPStan |
|
187
|
187
|
if (\in_array($field, $this->configuration->getIgnoredColumns(), true)) { |
|
188
|
188
|
// yes => $field is not audited |
|
189
|
189
|
return false; |
|
@@ -225,13 +225,13 @@ discard block |
|
|
block discarded – undo |
|
225
|
225
|
|
|
226
|
226
|
public function setStorageMapper(callable $storageMapper): void |
|
227
|
227
|
{ |
|
228
|
|
- \assert($this->configuration instanceof Configuration); // helps PHPStan |
|
|
228
|
+ \assert($this->configuration instanceof Configuration); // helps PHPStan |
|
229
|
229
|
$this->configuration->setStorageMapper($storageMapper); |
|
230
|
230
|
} |
|
231
|
231
|
|
|
232
|
232
|
private function loadAnnotations(EntityManagerInterface $entityManager): self |
|
233
|
233
|
{ |
|
234
|
|
- \assert($this->configuration instanceof Configuration); // helps PHPStan |
|
|
234
|
+ \assert($this->configuration instanceof Configuration); // helps PHPStan |
|
235
|
235
|
$annotationLoader = new AnnotationLoader($entityManager); |
|
236
|
236
|
$this->configuration->setEntities(array_merge( |
|
237
|
237
|
$this->configuration->getEntities(), |
|
@@ -243,7 +243,7 @@ discard block |
|
|
block discarded – undo |
|
243
|
243
|
|
|
244
|
244
|
private function checkStorageMapper(): self |
|
245
|
245
|
{ |
|
246
|
|
- \assert($this->configuration instanceof Configuration); // helps PHPStan |
|
|
246
|
+ \assert($this->configuration instanceof Configuration); // helps PHPStan |
|
247
|
247
|
if (null === $this->configuration->getStorageMapper() && $this->isStorageMapperRequired()) { |
|
248
|
248
|
throw new ProviderException('You must provide a mapper function to map audits to storage.'); |
|
249
|
249
|
} |