public function save(Mongodloid_Entity $entity, $save = false, $w = null) { $data = $entity->getRawData(); if (is_null($w)) { $w = $this->w; } $result = $this->_collection->save($data, array('save' => $save, 'w' => $w)); if (!$result) { return false; } $entity->setRawData($data); return true; }
/** * update the billing line with stamp to avoid another aggregation * * @param int $sid the subscriber id to update * @param Mongodloid_Entity $line the billing line to update * * @return boolean true on success else false */ protected function updateBillingLine($subscriber, $line) { if (isset($subscriber->id)) { $sid = $subscriber->id; } else { // todo: alert to log return false; } $current = $line->getRawData(); $added_values = array('sid' => $sid, 'billrun' => $this->getStamp()); if (isset($subscriber->aid)) { $added_values['aid'] = $subscriber->aid; } $newData = array_merge($current, $added_values); $line->setRawData($newData); return true; }