From 93709d6963e3400f594a8ca77132eb965b200120 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Toborek?= Date: Wed, 10 Jun 2015 16:56:24 +0200 Subject: [PATCH] EZP-23860: RecommendationBundle breaks left tree menu --- .../LegacySearch/LegacySearchFactory.php | 21 ++++--- eZ/Publish/LegacySearch/NullSearchEngine.php | 62 +++++++++++++++++++ .../RecommendationLegacySearchEngine.php | 9 --- 3 files changed, 75 insertions(+), 17 deletions(-) create mode 100644 eZ/Publish/LegacySearch/NullSearchEngine.php diff --git a/eZ/Publish/LegacySearch/LegacySearchFactory.php b/eZ/Publish/LegacySearch/LegacySearchFactory.php index 1f6b01e..ada6bd7 100644 --- a/eZ/Publish/LegacySearch/LegacySearchFactory.php +++ b/eZ/Publish/LegacySearch/LegacySearchFactory.php @@ -8,17 +8,22 @@ namespace EzSystems\RecommendationBundle\eZ\Publish\LegacySearch; -/** - * @TODO fixme - */ +use EzSystems\RecommendationBundle\eZ\Publish\LegacySearch; + class LegacySearchFactory { public static function build(\Closure $legacyKernelClosure) { - return $legacyKernelClosure()->runCallback( - function () { - return \eZSearch::getEngine(); - } - ); + try { + $searchEngine = $legacyKernelClosure()->runCallback( + function () { + return \eZSearch::getEngine(); + } + ); + } catch (\Exception $e) { + $searchEngine = new NullSearchEngine(); + } + + return $searchEngine; } } diff --git a/eZ/Publish/LegacySearch/NullSearchEngine.php b/eZ/Publish/LegacySearch/NullSearchEngine.php new file mode 100644 index 0000000..38f7027 --- /dev/null +++ b/eZ/Publish/LegacySearch/NullSearchEngine.php @@ -0,0 +1,62 @@ +legacySearchEngine->addNodeAssignment( $mainNodeID, $objectID, $nodeAssignmentIDList, $isMoved ); } } - - public static function buildLegacySearchEngine($legacyKernelClosure) - { - return $legacyKernelClosure()->runCallback( - function () { - return \eZSearch::getEngine(); - } - ); - } }