Skip to content

Commit

Permalink
Merge pull request #221 from maximehuran/feature/extendable-controller
Browse files Browse the repository at this point in the history
Controller attributes and functions can be extended
  • Loading branch information
maximehuran authored Aug 22, 2024
2 parents dcf4096 + cb3f6e3 commit 76bf3aa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
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

0 comments on commit 76bf3aa

Please sign in to comment.