You are here

final class ApiProductController in Apigee Edge 8

Same name in this branch
  1. 8 src/Entity/Controller/ApiProductController.php \Drupal\apigee_edge\Entity\Controller\ApiProductController
  2. 8 modules/apigee_edge_apiproduct_rbac/tests/modules/apigee_edge_apiproduct_rbac_test/src/ApiProductController.php \Drupal\apigee_edge_apiproduct_rbac_test\ApiProductController

Definition of the API product controller service.

This integrates the Management API's API product controller from the SDK's with Drupal.

Hierarchy

Expanded class hierarchy of ApiProductController

1 string reference to 'ApiProductController'
apigee_edge.services.yml in ./apigee_edge.services.yml
apigee_edge.services.yml
1 service uses ApiProductController
apigee_edge.controller.api_product in ./apigee_edge.services.yml
Drupal\apigee_edge\Entity\Controller\ApiProductController

File

src/Entity/Controller/ApiProductController.php, line 35

Namespace

Drupal\apigee_edge\Entity\Controller
View source
final class ApiProductController implements ApiProductControllerInterface, EntityCacheAwareControllerInterface {
  use CachedEntityCrudOperationsControllerTrait;
  use CachedPaginatedEntityIdListingControllerTrait;
  use CachedPaginatedEntityListingControllerTrait;
  use CachedPaginatedControllerHelperTrait;
  use CachedAttributesAwareEntityControllerTrait;

  /**
   * Local cache for the decorated API product controller from the SDK.
   *
   * @var \Apigee\Edge\Api\Management\Controller\ApiProductController|null
   *
   * @see decorated()
   */
  private $instance;

  /**
   * The SDK connector.
   *
   * @var \Drupal\apigee_edge\SDKConnectorInterface
   */
  private $connector;

  /**
   * The entity cache.
   *
   * @var \Drupal\apigee_edge\Entity\Controller\Cache\EntityCacheInterface
   */
  private $entityCache;

  /**
   * The entity id cache.
   *
   * @var \Drupal\apigee_edge\Entity\Controller\Cache\EntityIdCacheInterface
   */
  private $entityIdCache;

  /**
   * The organization controller service.
   *
   * @var \Drupal\apigee_edge\Entity\Controller\OrganizationControllerInterface
   */
  private $orgController;

  /**
   * ApiProductController constructor.
   *
   * @param \Drupal\apigee_edge\SDKConnectorInterface $connector
   *   The SDK connector service.
   * @param \Drupal\apigee_edge\Entity\Controller\OrganizationControllerInterface $org_controller
   *   The organization controller service.
   * @param \Drupal\apigee_edge\Entity\Controller\Cache\EntityCacheInterface $entity_cache
   *   The entity cache used by this controller.
   * @param \Drupal\apigee_edge\Entity\Controller\Cache\EntityIdCacheInterface $entity_id_cache
   *   The entity id cache used by this controller.
   */
  public function __construct(SDKConnectorInterface $connector, OrganizationControllerInterface $org_controller, EntityCacheInterface $entity_cache, EntityIdCacheInterface $entity_id_cache) {
    $this->connector = $connector;
    $this->orgController = $org_controller;
    $this->entityCache = $entity_cache;
    $this->entityIdCache = $entity_id_cache;
  }

  /**
   * Returns the decorated API product controller from the SDK.
   *
   * @return \Apigee\Edge\Api\Management\Controller\ApiProductControllerInterface
   *   The initialized API product controller.
   */
  protected function decorated() : EdgeApiProductControllerInterface {
    if ($this->instance === NULL) {
      $this->instance = new EdgeApiProductController($this->connector
        ->getOrganization(), $this->connector
        ->getClient(), NULL, $this->orgController);
    }
    return $this->instance;
  }

  /**
   * {@inheritdoc}
   */
  public function searchByAttribute(string $attribute_name, string $attribute_value) : array {
    return $this
      ->decorated()
      ->searchByAttribute($attribute_name, $attribute_value);
  }

  /**
   * {@inheritdoc}
   */
  public function getOrganisationName() : string {
    return $this
      ->decorated()
      ->getOrganisationName();
  }

  /**
   * {@inheritdoc}
   */
  public function entityCache() : EntityCacheInterface {
    return $this->entityCache;
  }

  /**
   * {@inheritdoc}
   */
  protected function entityIdCache() : EntityIdCacheInterface {
    return $this->entityIdCache;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ApiProductController::$connector private property The SDK connector.
ApiProductController::$entityCache private property The entity cache.
ApiProductController::$entityIdCache private property The entity id cache.
ApiProductController::$instance private property Local cache for the decorated API product controller from the SDK.
ApiProductController::$orgController private property The organization controller service.
ApiProductController::decorated protected function Returns the decorated API product controller from the SDK. Overrides CachedEntityCrudOperationsControllerTrait::decorated
ApiProductController::entityCache public function Returns the entity cache used by the controller. Overrides EntityCacheAwareControllerTrait::entityCache
ApiProductController::entityIdCache protected function Entity id cache used by the entity controller. Overrides CachedPaginatedEntityIdListingControllerTrait::entityIdCache
ApiProductController::getOrganisationName public function
ApiProductController::searchByAttribute public function
ApiProductController::__construct public function ApiProductController constructor.
CachedAttributesAwareEntityControllerTrait::deleteAttribute public function
CachedAttributesAwareEntityControllerTrait::getAttribute public function
CachedAttributesAwareEntityControllerTrait::getAttributes public function
CachedAttributesAwareEntityControllerTrait::updateAttribute public function
CachedAttributesAwareEntityControllerTrait::updateAttributes public function
CachedEntityCrudOperationsControllerTrait::create public function
CachedEntityCrudOperationsControllerTrait::delete public function
CachedEntityCrudOperationsControllerTrait::load public function 1
CachedEntityCrudOperationsControllerTrait::update public function
CachedPaginatedControllerHelperTrait::createPager public function
CachedPaginatedEntityIdListingControllerTrait::extractSubsetOfAssociativeArray abstract protected function
CachedPaginatedEntityIdListingControllerTrait::getEntityIds public function
CachedPaginatedEntityListingControllerTrait::getEntities public function