You are here

private function ScheduledPublishCron::updateEntity in Scheduled Publish 8.2

Same name and namespace in other branches
  1. 8.3 src/Service/ScheduledPublishCron.php \Drupal\scheduled_publish\Service\ScheduledPublishCron::updateEntity()

Updates entity

Parameters

\Drupal\Core\Entity\ContentEntityBase $entity:

string $moderationState:

string $scheduledPublishField:

$scheduledValue:

Throws

\Drupal\Core\Entity\EntityStorageException

1 call to ScheduledPublishCron::updateEntity()
ScheduledPublishCron::updateEntityField in src/Service/ScheduledPublishCron.php
Update scheduled publish fields

File

src/Service/ScheduledPublishCron.php, line 191

Class

ScheduledPublishCron
Class ScheduledPublishCron

Namespace

Drupal\scheduled_publish\Service

Code

private function updateEntity(ContentEntityBase $entity, string $moderationState, string $scheduledPublishField, $scheduledValue) : void {
  $entity
    ->set($scheduledPublishField, $scheduledValue);
  $entity
    ->set('moderation_state', $moderationState);
  $entity
    ->save();
}