You are here

public function ProvisionService::getProvisionFromContext in LTI Tool Provider 2.x

Same name and namespace in other branches
  1. 8 modules/lti_tool_provider_provision/src/Services/ProvisionService.php \Drupal\lti_tool_provider_provision\Services\ProvisionService::getProvisionFromContext()

Parameters

$context:

Return value

EntityInterface|null

Throws

InvalidPluginDefinitionException

PluginNotFoundException

1 call to ProvisionService::getProvisionFromContext()
ProvisionService::provision in modules/lti_tool_provider_provision/src/Services/ProvisionService.php

File

modules/lti_tool_provider_provision/src/Services/ProvisionService.php, line 126

Class

ProvisionService

Namespace

Drupal\lti_tool_provider_provision\Services

Code

public function getProvisionFromContext($context) : ?EntityInterface {
  $provision = $this->entityTypeManager
    ->getStorage('lti_tool_provider_provision')
    ->loadByProperties([
    'consumer_id' => $context['consumer_id'],
    'context_id' => $context['context_id'],
    'resource_link_id' => $context['resource_link_id'],
  ]);
  if (count($provision)) {
    return reset($provision);
  }
  return NULL;
}