public function changeStatusOfActivity(Activity $activity, $status = ACTIVITY_STATUS_RECEIVED) {
    $activity->set('field_activity_status', $status);

    return $activity->save();
  }
public function changeStatusOfActivity(Activity $activity, $status = ACTIVITY_STATUS_RECEIVED) {
    $activity->set('field_activity_status', $status);

    return $activity->save();
  }
public function changeStatusOfActivity ( Activity $ activity , $ status = ACTIVITY_STATUS_RECEIVED ) { $ activity -> set ( 'field_activity_status' , $ status ) ; return $ activity -> save ( ) ; }
Change the status of an activity.

@param \Drupal\activity_creator\Entity\Activity $activity
Activity object.
@param int $status
See: activity_creator_field_activity_status_allowed_values().

@return \Drupal\activity_creator\Entity\Activity
Returns activity object.
Change the status of an activity .