Skip to content

Commit

Permalink
Quick fix: EMongoDocument::update(null, true) cause a crash because _…
Browse files Browse the repository at this point in the history
…id is passed to the update() method.

Another fix : added parameters 'multiple'=>false as stated in PHP documentation
  • Loading branch information
pgaultier committed Feb 10, 2011
1 parent 8155832 commit 885e7e9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions EMongoDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -663,16 +663,19 @@ public function update(array $attributes=null, $modify = false)
}

if($modify)
{
if(isset($rawData['_id']) === true)
unset($rawData['_id']);
$result = $this->getCollection()->update(
array('_id' => $this->_id),
array('$set' => $rawData),
array(
'fsync'=>$this->getFsyncFlag(),
'safe'=>$this->getSafeFlag()
'safe'=>$this->getSafeFlag(),
'multiple'=>false
)
);
else
{
} else {
if(version_compare(Mongo::VERSION, '1.0.5','>=') === true)
$result = $this->getCollection()->save($rawData, array(
'fsync'=>$this->getFsyncFlag(),
Expand Down

0 comments on commit 885e7e9

Please sign in to comment.