modified classes for GeneralException thrown
This commit is contained in:
@ -38,7 +38,7 @@ abstract class MongoDbCommand
|
||||
if ($this->checkParams()) {
|
||||
return $this->concreteExecute();
|
||||
} else {
|
||||
throw new Exception(get_called_class() . ' error. Bind all required params first.');
|
||||
throw new GeneralException(get_called_class() . ' error. Bind all required params first.');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,14 @@ abstract class MongoModel extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* @TODO: test method
|
||||
*/
|
||||
public function deleteAll($query = array())
|
||||
{
|
||||
$this->db->delete($this->table(), $query);
|
||||
}
|
||||
|
||||
/**
|
||||
* @TODO: check for limits (if just one record needed)
|
||||
*/
|
||||
protected function fetchField($data, $params = array(), $field, $cache_key = null)
|
||||
|
@ -22,7 +22,7 @@ class MongoStatement extends DbStatement
|
||||
$this->result->sort($sort);
|
||||
return $this;
|
||||
} else {
|
||||
throw new Exception('MongoStatement error. Impossible order results of opened cursor.');
|
||||
throw new GeneralException('MongoStatement error. Impossible order results of opened cursor.');
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ class MongoStatement extends DbStatement
|
||||
$this->result->skip($skip);
|
||||
return $this;
|
||||
} else {
|
||||
throw new Exception('MongoStatement error. Impossible skip results of opened cursor.');
|
||||
throw new GeneralException('MongoStatement error. Impossible skip results of opened cursor.');
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ class MongoStatement extends DbStatement
|
||||
$this->result->limit($limit);
|
||||
return $this;
|
||||
} else {
|
||||
throw new Exception('MongoStatement error. Impossible limit results of opened cursor.');
|
||||
throw new GeneralException('MongoStatement error. Impossible limit results of opened cursor.');
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ class MongoStatement extends DbStatement
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new Exception('Invalid fetch mode "' . $style . '" specified');
|
||||
throw new GeneralException('Invalid fetch mode "' . $style . '" specified');
|
||||
}
|
||||
return $row;
|
||||
}
|
||||
@ -132,7 +132,7 @@ class MongoStatement extends DbStatement
|
||||
$result = $request->execute();
|
||||
}
|
||||
if ($result === false) {
|
||||
throw new Exception('MongoDB request error.');
|
||||
throw new GeneralException('MongoDB request error.');
|
||||
}
|
||||
if ($result instanceof MongoCursor || is_array($result)) {
|
||||
$this->result = $result;
|
||||
@ -148,7 +148,7 @@ class MongoStatement extends DbStatement
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
throw new Exception('No connection to MongoDB server.');
|
||||
throw new GeneralException('No connection to MongoDB server.');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,10 +25,10 @@ class MySQLiStatement extends DbStatement
|
||||
}
|
||||
if (count($this->map) > 0) {
|
||||
if (!is_string($param) && !is_int($param)) {
|
||||
throw new Exception('Placeholder must be an array or string');
|
||||
throw new GeneralException('Placeholder must be an array or string');
|
||||
}
|
||||
if (is_object($value) && ! ($value instanceof DbExpr)) {
|
||||
throw new Exception('Objects excepts DbExpr not allowed.');
|
||||
throw new GeneralException('Objects excepts DbExpr not allowed.');
|
||||
}
|
||||
if (isset($this->map[$param])) {
|
||||
$this->params[$param] = &$value;
|
||||
|
Reference in New Issue
Block a user