ApiProductStorage.php in Apigee Edge 8
File
src/Entity/Storage/ApiProductStorage.php
View source
<?php
namespace Drupal\apigee_edge\Entity\Storage;
use Drupal\apigee_edge\Entity\Controller\ApiProductControllerInterface;
use Drupal\apigee_edge\Entity\Controller\CachedManagementApiEdgeEntityControllerProxy;
use Drupal\apigee_edge\Entity\Controller\EdgeEntityControllerInterface;
use Drupal\apigee_edge\Entity\Controller\EntityCacheAwareControllerInterface;
use Drupal\apigee_edge\Entity\Controller\ManagementApiEdgeEntityControllerProxy;
use Drupal\Component\Datetime\TimeInterface;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Cache\MemoryCache\MemoryCacheInterface;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
class ApiProductStorage extends EdgeEntityStorageBase implements ApiProductStorageInterface {
private $apiProductController;
public function __construct(EntityTypeInterface $entity_type, CacheBackendInterface $cache_backend, MemoryCacheInterface $memory_cache, TimeInterface $system_time, ApiProductControllerInterface $api_product_controller, ConfigFactoryInterface $config) {
parent::__construct($entity_type, $cache_backend, $memory_cache, $system_time);
$this->cacheExpiration = $config
->get('apigee_edge.api_product_settings')
->get('cache_expiration');
$this->apiProductController = $api_product_controller;
}
public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) {
return new static($entity_type, $container
->get('cache.apigee_edge_entity'), $container
->get('entity.memory_cache'), $container
->get('datetime.time'), $container
->get('apigee_edge.controller.api_product'), $container
->get('config.factory'));
}
protected function entityController() : EdgeEntityControllerInterface {
if ($this->apiProductController instanceof EntityCacheAwareControllerInterface) {
return new CachedManagementApiEdgeEntityControllerProxy($this->apiProductController);
}
return new ManagementApiEdgeEntityControllerProxy($this->apiProductController);
}
}