You are here

public static function WebformSubmissionStorage::createInstance in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/WebformSubmissionStorage.php \Drupal\webform\WebformSubmissionStorage::createInstance()

Instantiates a new instance of this entity handler.

This is a factory method that returns a new instance of this object. The factory should pass any needed dependencies into the constructor of this object, but not the container itself. Every call to this method must return a new instance of this object; that is, it may not implement a singleton.

Parameters

\Symfony\Component\DependencyInjection\ContainerInterface $container: The service container this object should use.

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type definition.

Return value

static A new instance of the entity handler.

Overrides SqlContentEntityStorage::createInstance

File

src/WebformSubmissionStorage.php, line 99

Class

WebformSubmissionStorage
Defines the webform submission storage.

Namespace

Drupal\webform

Code

public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) {
  $instance = parent::createInstance($container, $entity_type);
  $instance->time = $container
    ->get('datetime.time');
  $instance->replicaKillSwitch = $container
    ->get('database.replica_kill_switch');
  $instance->currentUser = $container
    ->get('current_user');
  $instance->fileSystem = $container
    ->get('file_system');
  $instance->streamWrapperManager = $container
    ->get('stream_wrapper_manager');
  $instance->loggerFactory = $container
    ->get('logger.factory');
  $instance->entityTypeRepository = $container
    ->get('entity_type.repository');
  $instance->accessRulesManager = $container
    ->get('webform.access_rules_manager');
  $instance->elementManager = $container
    ->get('plugin.manager.webform.element');
  return $instance;
}