added butchInsert to mongo model

This commit is contained in:
Anton Grebnev
2012-01-18 23:30:34 +04:00
parent d1723cb87b
commit 99a528fac3
6 changed files with 118 additions and 18 deletions

View File

@ -32,18 +32,23 @@ abstract class MongoModel extends Model
public function get($id)
{
if($this->useMongoId) {
if(! $id instanceof MongoId) {
if ($this->useMongoId) {
if (!$id instanceof MongoId) {
$id = new MongoId($id);
}
}
return $this->db->get($this->table(), array('_id' => $id))->fetch();
}
public function batchInsert($data)
{
return $this->db->insert($this->table(), $data, true);
}
public function delete($id)
{
if($this->useMongoId) {
if(! $id instanceof MongoId) {
if ($this->useMongoId) {
if (!$id instanceof MongoId) {
$id = new MongoId($id);
}
}