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 ...@@ -573,13 +573,10 @@ class Solarium_Query_Select extends Solarium_Query
throw new Solarium_Exception('A filterquery must have a key value'); throw new Solarium_Exception('A filterquery must have a key value');
} }
if (array_key_exists($key, $this->_filterQueries)) { //double add calls for the same FQ are ignored, but non-unique keys cause an exception
if ($this->_filterQueries[$key] === $filterQuery) { //@todo add trigger_error with a notice for double add calls?
//double add calls for the same FQ are ignored if (array_key_exists($key, $this->_filterQueries) && $this->_filterQueries[$key] !== $filterQuery) {
//@todo add trigger_error with a notice? throw new Solarium_Exception('A filterquery must have a unique key value within a query');
} else {
throw new Solarium_Exception('A filterquery must have a unique key value within a query');
}
} else { } else {
$this->_filterQueries[$key] = $filterQuery; $this->_filterQueries[$key] = $filterQuery;
} }
......
...@@ -266,13 +266,10 @@ class Solarium_Query_Select_Component_FacetSet extends Solarium_Query_Select_Com ...@@ -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'); throw new Solarium_Exception('A facet must have a key value');
} }
if (array_key_exists($key, $this->_facets)) { //double add calls for the same facet are ignored, but non-unique keys cause an exception
if ($this->_facets[$key] === $facet) { //@todo add trigger_error with a notice for double add calls?
//double add calls for the same facet are ignored if (array_key_exists($key, $this->_facets) && $this->_facets[$key] !== $facet) {
//@todo add trigger_error with a notice? throw new Solarium_Exception('A facet must have a unique key value within a query');
} else {
throw new Solarium_Exception('A facet must have a unique key value within a query');
}
} else { } else {
$this->_facets[$key] = $facet; $this->_facets[$key] = $facet;
} }
......
...@@ -140,13 +140,10 @@ class Solarium_Query_Select_Component_Stats extends Solarium_Query_Select_Compon ...@@ -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'); throw new Solarium_Exception('A field must have a key value');
} }
if (array_key_exists($key, $this->_fields)) { //double add calls for the same field are ignored, but non-unique keys cause an exception
if ($this->_fields[$key] === $field) { //@todo add trigger_error with a notice for double add calls?
//double add calls for the same FQ are ignored if (array_key_exists($key, $this->_fields) && $this->_fields[$key] !== $field) {
//@todo add trigger_error with a notice? throw new Solarium_Exception('A field must have a unique key value');
} else {
throw new Solarium_Exception('A field must have a unique key value');
}
} else { } else {
$this->_fields[$key] = $field; $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