final class DeveloperAppNameCacheFactory in Apigee Edge 8
Developer specific app name cache by app owner factory service.
This service ensures that the same cache instance is being used for the same developer's developer apps even if the developer is sometimes referenced by its UUID and sometimes by its email address.
Hierarchy
- class \Drupal\apigee_edge\Entity\Controller\Cache\DeveloperAppNameCacheFactory implements AppNameCacheByOwnerFactoryInterface
Expanded class hierarchy of DeveloperAppNameCacheFactory
1 string reference to 'DeveloperAppNameCacheFactory'
1 service uses DeveloperAppNameCacheFactory
File
- src/
Entity/ Controller/ Cache/ DeveloperAppNameCacheFactory.php, line 34
Namespace
Drupal\apigee_edge\Entity\Controller\CacheView source
final class DeveloperAppNameCacheFactory implements AppNameCacheByOwnerFactoryInterface {
/**
* The (general) app name cache by owner factory service.
*
* @var \Drupal\apigee_edge\Entity\Controller\Cache\AppNameCacheByOwnerFactoryInterface
*/
private $appNameCacheByOwnerFactory;
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
private $entityTypeManager;
/**
* The email validator service.
*
* @var \Drupal\Component\Utility\EmailValidatorInterface
*/
private $emailValidator;
/**
* DeveloperAppNameCacheFactory constructor.
*
* @param \Drupal\apigee_edge\Entity\Controller\Cache\AppNameCacheByOwnerFactoryInterface $app_name_cache_by_owner_factory
* The (general) app name cache by app owner factory service.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
* @param \Drupal\Component\Utility\EmailValidatorInterface $email_validator
* The email validator service.
*/
public function __construct(AppNameCacheByOwnerFactoryInterface $app_name_cache_by_owner_factory, EntityTypeManagerInterface $entity_type_manager, EmailValidatorInterface $email_validator) {
$this->appNameCacheByOwnerFactory = $app_name_cache_by_owner_factory;
$this->entityTypeManager = $entity_type_manager;
$this->emailValidator = $email_validator;
}
/**
* {@inheritdoc}
*/
public function getAppNameCache(string $owner) : EntityIdCacheInterface {
if ($this->emailValidator
->isValid($owner)) {
/** @var \Drupal\apigee_edge\Entity\Developer $developer */
$developer = $this->entityTypeManager
->getStorage('developer')
->load($owner);
if ($developer === NULL) {
throw new DeveloperDoesNotExistException($owner);
}
$owner = $developer
->getDeveloperId();
}
return $this->appNameCacheByOwnerFactory
->getAppNameCache($owner);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DeveloperAppNameCacheFactory:: |
private | property | The (general) app name cache by owner factory service. | |
DeveloperAppNameCacheFactory:: |
private | property | The email validator service. | |
DeveloperAppNameCacheFactory:: |
private | property | The entity type manager. | |
DeveloperAppNameCacheFactory:: |
public | function |
Returns the same app name cache instance for an owner. Overrides AppNameCacheByOwnerFactoryInterface:: |
|
DeveloperAppNameCacheFactory:: |
public | function | DeveloperAppNameCacheFactory constructor. |