You are here

public static function QueueStorageEntity::preCreate in Open Social 10.0.x

Same name and namespace in other branches
  1. 8.9 modules/custom/social_queue_storage/src/Entity/QueueStorageEntity.php \Drupal\social_queue_storage\Entity\QueueStorageEntity::preCreate()
  2. 8.8 modules/custom/social_queue_storage/src/Entity/QueueStorageEntity.php \Drupal\social_queue_storage\Entity\QueueStorageEntity::preCreate()
  3. 10.3.x modules/custom/social_queue_storage/src/Entity/QueueStorageEntity.php \Drupal\social_queue_storage\Entity\QueueStorageEntity::preCreate()
  4. 10.1.x modules/custom/social_queue_storage/src/Entity/QueueStorageEntity.php \Drupal\social_queue_storage\Entity\QueueStorageEntity::preCreate()
  5. 10.2.x modules/custom/social_queue_storage/src/Entity/QueueStorageEntity.php \Drupal\social_queue_storage\Entity\QueueStorageEntity::preCreate()

Changes the values of an entity before it is created.

Load defaults for example.

Parameters

\Drupal\Core\Entity\EntityStorageInterface $storage: The entity storage object.

mixed[] $values: An array of values to set, keyed by property name. If the entity type has bundles the bundle key has to be specified.

Overrides EntityBase::preCreate

File

modules/custom/social_queue_storage/src/Entity/QueueStorageEntity.php, line 64

Class

QueueStorageEntity
Defines the Queue storage entity entity.

Namespace

Drupal\social_queue_storage\Entity

Code

public static function preCreate(EntityStorageInterface $storage_controller, array &$values) {
  parent::preCreate($storage_controller, $values);
  $values += [
    'user_id' => \Drupal::currentUser()
      ->id(),
  ];
}