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.
This commit is contained in:
Guy Sartorelli 2022-06-30 10:53:02 +12:00
parent 76be4578d6
commit 4e53c35b53

View File

@ -74,7 +74,8 @@ class SearchContext
protected $searchParams = []; 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 * @var string
*/ */
public $connective = 'AND'; public $connective = 'AND';
@ -146,6 +147,10 @@ class SearchContext
*/ */
public function getQuery($searchParams, $sort = false, $limit = false, $existingQuery = null) 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 */ /** DataList $query */
$query = null; $query = null;
if ($existingQuery) { 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; return $query;
} }