Beispiel #1
0
 public function afterSave($insert, $changedAttributes)
 {
     parent::afterSave($insert, $changedAttributes);
     // when insert false, then record has been updated
     if (!$insert) {
         // add StatusLog entry
         $status_log = new StatusLog();
         $status_log->status_id = $this->id;
         $status_log->updated_by = $this->updated_by;
         $status_log->created_at = time();
         $status_log->save();
     }
 }
Beispiel #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = StatusLog::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'status_id' => $this->status_id, 'updated_by' => $this->updated_by, 'created_at' => $this->created_at]);
     return $dataProvider;
 }