modified model classes with tests
This commit is contained in:
@ -13,26 +13,11 @@
|
||||
abstract class MongoModel extends Model
|
||||
{
|
||||
|
||||
public function find($condition)
|
||||
public function find($condition = array())
|
||||
{
|
||||
return $this->db->find($this->table(), $condition);
|
||||
}
|
||||
|
||||
protected function order(MongoStatement $cursor, $sort = array())
|
||||
{
|
||||
return $cursor->sort($sort);
|
||||
}
|
||||
|
||||
protected function skip(MongoStatement $cursor, $skip = 0)
|
||||
{
|
||||
return $cursor->skip($skip);
|
||||
}
|
||||
|
||||
protected function limit(MongoStatement $cursor, $limit = 0)
|
||||
{
|
||||
return $cursor->limit($limit);
|
||||
}
|
||||
|
||||
public function get($id)
|
||||
{
|
||||
return $this->db->get($this->table(), array('_id' => $id))->fetch();
|
||||
@ -40,7 +25,7 @@ abstract class MongoModel extends Model
|
||||
|
||||
public function delete($id)
|
||||
{
|
||||
return $this->db->delete($this->table(), array('id' => $id));
|
||||
return $this->db->delete($this->table(), array('_id' => $id));
|
||||
}
|
||||
|
||||
protected function fetchField($data, $params = array(), $field, $cache_key = null)
|
||||
|
Reference in New Issue
Block a user