Ejemplo n.º 1
0
 public function save()
 {
     if ($this->record_changed) {
         $this->modified(date('Y-m-d H:i:s'));
     }
     return parent::save();
 }
Ejemplo n.º 2
0
 public function save()
 {
     $stack = debug_backtrace();
     $lane_push = false;
     if (isset($stack[1]) && $stack[1]['function'] == 'pushToLanes') {
         $lane_push = true;
     }
     if ($this->record_changed && !$lane_push) {
         $this->modified(date('Y-m-d H:i:s'));
     }
     return parent::save();
 }
Ejemplo n.º 3
0
 public function save()
 {
     // using save() to update lane-side product records
     // 1) always write the record
     // 2) not create a prodUpdate entry
     $stack = debug_backtrace();
     $lane_push = false;
     if (isset($stack[1]) && $stack[1]['function'] == 'pushToLanes') {
         $lane_push = true;
     }
     // writing DB is not necessary
     if (!$this->record_changed && !$lane_push) {
         return true;
     } else {
         if ($this->record_changed) {
             $this->modified(date('Y-m-d H:i:s'));
         }
     }
     // call parent method to save the product record,
     // then add a corresponding prodUpdate record
     $try = parent::save();
     if ($try && !$lane_push && $this->connection->tableExists('prodUpdate')) {
         $update = new ProdUpdateModel($this->connection);
         $update->upc($this->upc());
         $update->logUpdate(ProdUpdateModel::UPDATE_EDIT);
     }
     return $try;
 }
Ejemplo n.º 4
0
 /**
  * save a map
  * @return mixed
  */
 public function save()
 {
     $mapModel = parent::save();
     // check if map type has changed and clear access objects
     if (!$mapModel->dry()) {
         if ($mapModel->isPrivate()) {
             $mapModel->clearAccess(['corporation', 'alliance']);
         } elseif ($mapModel->isCorporation()) {
             $mapModel->clearAccess(['user', 'alliance']);
         } elseif ($mapModel->isAlliance()) {
             $mapModel->clearAccess(['user', 'corporation']);
         }
     }
     return $mapModel;
 }