|
|
@@ -1695,10 +1695,15 @@ class Query implements ExpressionInterface, IteratorAggregate
|
|
|
*
|
|
|
* @param string $name name of the clause to be returned
|
|
|
* @return mixed
|
|
|
+ * @throws InvalidArgumentException When the named clause does not exist.
|
|
|
*/
|
|
|
public function clause($name)
|
|
|
{
|
|
|
- return isset($this->_parts[$name]) ? $this->_parts[$name] : null;
|
|
|
+ if (!array_key_exists($name, $this->_parts)) {
|
|
|
+ $clauses = implode(', ', array_keys($this->_parts));
|
|
|
+ throw new InvalidArgumentException("The '$name' clause is not defined. Valid clauses are: $clauses");
|
|
|
+ }
|
|
|
+ return $this->_parts[$name];
|
|
|
}
|
|
|
|
|
|
/**
|