Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Controller attributes and functions can be extended #221

Merged
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export COMPOSE_PROJECT_NAME=search
export MIGRATIONS_NAMESPACE=MonsieurBiz\\SyliusSearchPlugin\\Migrations
export USER_UID=$(shell id -u)
PLUGIN_NAME=sylius-${COMPOSE_PROJECT_NAME}-plugin
COMPOSE=docker-compose
COMPOSE=docker compose
YARN=yarn

###
Expand Down
20 changes: 10 additions & 10 deletions src/Controller/SearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@

class SearchController extends AbstractController
{
private Search $search;
protected Search $search;

private CurrencyContextInterface $currencyContext;
protected CurrencyContextInterface $currencyContext;

private LocaleContextInterface $localeContext;
protected LocaleContextInterface $localeContext;

private ChannelContextInterface $channelContext;
protected ChannelContextInterface $channelContext;

private SettingsInterface $searchSettings;
protected SettingsInterface $searchSettings;

private ServiceRegistryInterface $documentableRegistry;
protected ServiceRegistryInterface $documentableRegistry;

private ParametersParserInterface $parametersParser;
protected ParametersParserInterface $parametersParser;

public function __construct(
Search $search,
Expand Down Expand Up @@ -162,7 +162,7 @@ public function taxonAction(
]);
}

private function getDocumentable(?string $documentType): DocumentableInterface
protected function getDocumentable(?string $documentType): DocumentableInterface
{
if (null === $documentType) {
$documentables = $this->getSearchEnabledDocumentables();
Expand All @@ -178,14 +178,14 @@ private function getDocumentable(?string $documentType): DocumentableInterface
}
}

private function getSearchEnabledDocumentables(): array
protected function getSearchEnabledDocumentables(): array
{
return array_filter($this->documentableRegistry->all(), function (DocumentableInterface $documentable) {
return (bool) $this->searchSettings->getCurrentValue($this->channelContext->getChannel(), null, 'search_enabled__' . $documentable->getIndexCode());
});
}

private function getInstantSearchEnabledDocumentables(): array
protected function getInstantSearchEnabledDocumentables(): array
{
return array_filter($this->documentableRegistry->all(), function (DocumentableInterface $documentable) {
return (bool) $this->searchSettings->getCurrentValue($this->channelContext->getChannel(), null, 'instant_search_enabled__' . $documentable->getIndexCode());
Expand Down
Loading