Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/Event/MappingProviderEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@ class MappingProviderEvent extends Event
*/
private ?ArrayObject $mapping;

private array $context;

/**
* @param ArrayObject<string, array>|null $mapping
*/
public function __construct(string $indexCode, ?ArrayObject $mapping)
public function __construct(string $indexCode, ?ArrayObject $mapping, array $context = [])
{
$this->indexCode = $indexCode;
$this->mapping = $mapping;
$this->context = $context;
}

public function getIndexCode(): string
Expand All @@ -48,4 +51,9 @@ public function getMapping(): ?ArrayObject
{
return $this->mapping;
}

public function getContext(): array
{
return $this->context;
}
}
2 changes: 1 addition & 1 deletion src/Mapping/YamlWithLocaleProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function provideMapping(string $indexName, array $context = []): ?array
$mapping = $this->appendLocaleAnalyzers($configurationDirectory, $mapping, $locale);
}

$mappingProviderEvent = new MappingProviderEvent($context['index_code'] ?? $indexName, new ArrayObject($mapping));
$mappingProviderEvent = new MappingProviderEvent($context['index_code'] ?? $indexName, new ArrayObject($mapping), $context);
$this->eventDispatcher->dispatch(
$mappingProviderEvent,
MappingProviderEvent::EVENT_NAME
Expand Down
Loading