From 4e53c35b534ab16483dba648145ac51a24e96b3e Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Thu, 30 Jun 2022 10:53:02 +1200 Subject: [PATCH] MNT Deprecate unusable property This property must always have the value 'AND' or an exception will be thrown - it should be deprecated. Also, no need to process the query before throwing. --- src/ORM/Search/SearchContext.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/ORM/Search/SearchContext.php b/src/ORM/Search/SearchContext.php index 56e668411..09cee24bc 100644 --- a/src/ORM/Search/SearchContext.php +++ b/src/ORM/Search/SearchContext.php @@ -74,7 +74,8 @@ class SearchContext protected $searchParams = []; /** - * The logical connective used to join WHERE clauses. Defaults to AND. + * The logical connective used to join WHERE clauses. Must be "AND". + * @deprecated 5.0 * @var string */ public $connective = 'AND'; @@ -146,6 +147,10 @@ class SearchContext */ public function getQuery($searchParams, $sort = false, $limit = false, $existingQuery = null) { + if ($this->connective != "AND") { + throw new Exception("SearchContext connective '$this->connective' not supported after ORM-rewrite."); + } + /** DataList $query */ $query = null; if ($existingQuery) { @@ -204,10 +209,6 @@ class SearchContext } } - if ($this->connective != "AND") { - throw new Exception("SearchContext connective '$this->connective' not supported after ORM-rewrite."); - } - return $query; }