getServiceManager()->get(Search::SERVICE_ID); $isGenerisSearch = $currentSearch instanceof GenerisSearch; $defaultSearch = $isGenerisSearch ? $currentSearch : new GenerisSearch(); $searchProxy = new SearchProxy(); $searchProxy->withDefaultSearch($defaultSearch); if (!$isGenerisSearch) { $searchProxy->withAdvancedSearch($currentSearch); } $this->getServiceManager()->register(SearchProxy::SERVICE_ID, $searchProxy); } public function down(Schema $schema): void { /** @var SearchProxy $searchProxy */ $searchProxy = $this->getServiceManager()->get(SearchProxy::SERVICE_ID); /** @var Search $legacySearch */ $legacySearch = $searchProxy->getAdvancedSearch() ?? $searchProxy->getDefaultSearch(); $this->getServiceManager()->unregister(SearchProxy::SERVICE_ID); $this->getServiceManager()->register(Search::SERVICE_ID, $legacySearch); } }