Commit 5c2adfa1 authored by Bas de Nooijer's avatar Bas de Nooijer

Improved exception logic

parent db2490de
......@@ -573,13 +573,10 @@ class Solarium_Query_Select extends Solarium_Query
throw new Solarium_Exception('A filterquery must have a key value');
}
if (array_key_exists($key, $this->_filterQueries)) {
if ($this->_filterQueries[$key] === $filterQuery) {
//double add calls for the same FQ are ignored
//@todo add trigger_error with a notice?
} else {
throw new Solarium_Exception('A filterquery must have a unique key value within a query');
}
//double add calls for the same FQ are ignored, but non-unique keys cause an exception
//@todo add trigger_error with a notice for double add calls?
if (array_key_exists($key, $this->_filterQueries) && $this->_filterQueries[$key] !== $filterQuery) {
throw new Solarium_Exception('A filterquery must have a unique key value within a query');
} else {
$this->_filterQueries[$key] = $filterQuery;
}
......
......@@ -266,13 +266,10 @@ class Solarium_Query_Select_Component_FacetSet extends Solarium_Query_Select_Com
throw new Solarium_Exception('A facet must have a key value');
}
if (array_key_exists($key, $this->_facets)) {
if ($this->_facets[$key] === $facet) {
//double add calls for the same facet are ignored
//@todo add trigger_error with a notice?
} else {
throw new Solarium_Exception('A facet must have a unique key value within a query');
}
//double add calls for the same facet are ignored, but non-unique keys cause an exception
//@todo add trigger_error with a notice for double add calls?
if (array_key_exists($key, $this->_facets) && $this->_facets[$key] !== $facet) {
throw new Solarium_Exception('A facet must have a unique key value within a query');
} else {
$this->_facets[$key] = $facet;
}
......
......@@ -140,13 +140,10 @@ class Solarium_Query_Select_Component_Stats extends Solarium_Query_Select_Compon
throw new Solarium_Exception('A field must have a key value');
}
if (array_key_exists($key, $this->_fields)) {
if ($this->_fields[$key] === $field) {
//double add calls for the same FQ are ignored
//@todo add trigger_error with a notice?
} else {
throw new Solarium_Exception('A field must have a unique key value');
}
//double add calls for the same field are ignored, but non-unique keys cause an exception
//@todo add trigger_error with a notice for double add calls?
if (array_key_exists($key, $this->_fields) && $this->_fields[$key] !== $field) {
throw new Solarium_Exception('A field must have a unique key value');
} else {
$this->_fields[$key] = $field;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment