예제 #1
0
 private function execute($obj)
 {
     $models = \Site_Model::get4relation($this->_model_to, $this->_conditions, $obj);
     foreach ($models as $model) {
         $model->delete();
     }
 }
예제 #2
0
 private static function delete_member_watch_content($obj, $conditions)
 {
     if (!($member_watch_contents = \Site_Model::get4relation('\\Notice\\Model_MemberWatchContent', $conditions, $obj))) {
         return false;
     }
     foreach ($member_watch_contents as $member_watch_content) {
         $member_watch_content->delete();
     }
 }
예제 #3
0
 private function execute($obj)
 {
     $models = \Site_Model::get4relation($this->_model_to, $this->_conditions, $obj);
     foreach ($models as $this->update_model) {
         //$this->update_model->{$this->_update_property} = \DB::expr(sprintf('`%s` + 1', $this->_update_property));
         $this->update_model->{$this->_update_property} = $this->update_model->{$this->_update_property} + 1;
         $this->set_optional_value($obj);
         $res = $this->update_model->save();
     }
 }
예제 #4
0
 private function execute($obj)
 {
     $models = \Site_Model::get4relation($this->_model_to, $this->_conditions, $obj);
     foreach ($models as $model) {
         $params = array();
         if (!empty($this->_execute_func['params'])) {
             foreach ($this->_execute_func['params'] as $value_from => $type) {
                 $params[] = \Site_Model::get_value_for_observer_setting($model, $value_from, $type);
             }
         }
         call_user_func_array($this->_execute_func['method'], $params);
     }
 }
예제 #5
0
 private function execute($obj)
 {
     $models = \Site_Model::get4relation($this->_model_to, $this->_conditions, $obj);
     foreach ($models as $model) {
         //$expr = \DB::expr(sprintf('CASE WHEN `%s` -1 < 0 THEN 0 ELSE `%s` - 1 END', $this->_update_property, $this->_update_property));
         //$model->{$this->_update_property} = $expr;
         $model->{$this->_update_property} = $model->{$this->_update_property} - 1;
         if ($model->{$this->_update_property} < 0) {
             $model->{$this->_update_property} = 0;
         }
         $model->save();
     }
 }
예제 #6
0
 private function execute($obj)
 {
     $models = \Site_Model::get4relation($this->_model_to, $this->_conditions, $obj);
     foreach ($models as $model) {
         foreach ($this->_update_properties as $property_to => $froms) {
             if (!is_array($froms)) {
                 $model->{$froms} = $obj->{$froms};
             } else {
                 foreach ($froms as $value_from => $type) {
                     $value = \Site_Model::get_value_for_observer_setting($obj, $value_from, $type);
                     $model->{$property_to} = $value;
                 }
             }
         }
         if (!$model->is_changed()) {
             continue;
         }
         $model->save();
     }
 }