From 6411ce96f21fd3b9c045aa22ba967e9eae7d0901 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mantas=20Marcinkevi=C4=8Dius?= Date: Mon, 12 Sep 2016 14:39:04 +0300 Subject: [PATCH] added a --- Event/PreProcessSearchEvent.php | 57 +++++++++++++++++++++++++++++++++ ONGRFilterManagerEvents.php | 6 ++++ 2 files changed, 63 insertions(+) create mode 100644 Event/PreProcessSearchEvent.php diff --git a/Event/PreProcessSearchEvent.php b/Event/PreProcessSearchEvent.php new file mode 100644 index 00000000..2a94d23b --- /dev/null +++ b/Event/PreProcessSearchEvent.php @@ -0,0 +1,57 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace ONGR\FilterManagerBundle\Event; + +use ONGR\ElasticsearchDSL\Search; +use ONGR\FilterManagerBundle\Filter\FilterInterface; +use Symfony\Component\EventDispatcher\Event; + +class PreProcessSearchEvent extends Event +{ + /** + * @var FilterInterface + */ + private $filter; + + /** + * @var Search + */ + private $relatedSearch; + + /** + * Constructor + * + * @param FilterInterface $filter + * @param Search $relatedSearch + */ + public function __construct(FilterInterface $filter, Search $relatedSearch) + { + $this->filter = $filter; + $this->relatedSearch = $relatedSearch; + } + + /** + * @return FilterInterface + */ + public function getFilter() + { + return $this->filter; + } + + /** + * @return Search + */ + public function getRelatedSearch() + { + return $this->relatedSearch; + } +} diff --git a/ONGRFilterManagerEvents.php b/ONGRFilterManagerEvents.php index c2713bac..d0e168e9 100644 --- a/ONGRFilterManagerEvents.php +++ b/ONGRFilterManagerEvents.php @@ -25,4 +25,10 @@ final class ONGRFilterManagerEvents * The SEARCH_RESPONSE event occurs after search is executed */ const SEARCH_RESPONSE = 'ongr_filter_manager.search_response'; + + /** + * The PRE_PROCESS_SEARCH event occurs before the preProcessSearch method of + * the filter is called + */ + const PRE_PROCESS_SEARCH = 'ongr_filter_manager.pre_process_search'; }