Esempio n. 1
0
 public function equals(Mongodloid_Entity $obj)
 {
     $data1 = $this->getRawData();
     $data2 = $obj->getRawData();
     unset($data1['_id'], $data2['_id']);
     return $data1 == $data2;
 }
Esempio n. 2
0
 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;
 }
Esempio n. 3
0
 /**
  * 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;
 }