You are here

class ApiProduct in Apigee Edge 8

Defines the API product entity class.

@\Drupal\apigee_edge\Annotation\EdgeEntityType( id = "api_product", label =

Plugin annotation


@Translation("API"),
  label_collection = @Translation("APIs"),
  label_singular = @Translation("API"),
  label_plural = @Translation("APIs"),
  label_count = @PluralTranslation(
    singular = "@count API",
    plural = "@count APIs",
  ),
  config_with_labels = "apigee_edge.api_product_settings",
  handlers = {
    "storage" = "\Drupal\apigee_edge\Entity\Storage\ApiProductStorage",
    "access" = "Drupal\Core\Entity\EntityAccessControlHandler",
  },
)

Hierarchy

Expanded class hierarchy of ApiProduct

12 files declare their use of ApiProduct
ApigeeEdgeFunctionalTestTrait.php in tests/src/Traits/ApigeeEdgeFunctionalTestTrait.php
apigee_edge.module in ./apigee_edge.module
Copyright 2018 Google Inc.
ApiProductAccessTest.php in tests/src/FunctionalJavascript/ApiProductAccessTest.php
ApiProductTest.php in tests/src/Unit/Entity/ApiProductTest.php
AppListBuilderTest.php in tests/src/Kernel/Entity/ListBuilder/AppListBuilderTest.php

... See full list

File

src/Entity/ApiProduct.php, line 46

Namespace

Drupal\apigee_edge\Entity
View source
class ApiProduct extends EdgeEntityBase implements ApiProductInterface {

  // The majority of Drupal core & contrib assumes that an entity to be
  // displayed is a content entity, and because it is a content entity it also
  // must support revisioning.
  // Having this trait addresses the following issue in the EntityViewBuilder.
  // https://www.drupal.org/node/2951487
  use RevisioningWorkaroundTrait;

  /**
   * ApiProduct constructor.
   *
   * @param array $values
   *   An array of values to set, keyed by property name.
   * @param null|string $entity_type
   *   Type of the entity. It is optional because constructor sets its default
   *   value.
   * @param \Apigee\Edge\Entity\EntityInterface|null $decorated
   *   The SDK entity that this Drupal entity decorates.
   */
  public function __construct(array $values, ?string $entity_type = NULL, ?EdgeEntityInterface $decorated = NULL) {
    $entity_type = $entity_type ?? 'api_product';
    parent::__construct($values, $entity_type, $decorated);
  }

  /**
   * {@inheritdoc}
   *
   * We have to override this to make it compatible with the SDK's
   * entity interface that has return type hint.
   */
  public function id() : ?string {
    return parent::id();
  }

  /**
   * {@inheritdoc}
   */
  protected function drupalEntityId() : ?string {
    return $this
      ->getName();
  }

  /**
   * {@inheritdoc}
   */
  protected static function decoratedClass() : string {
    return EdgeApiProduct::class;
  }

  /**
   * {@inheritdoc}
   */
  public static function idProperty() : string {
    return EdgeApiProduct::idProperty();
  }

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

  /**
   * {@inheritdoc}
   */
  public function setProxies(string ...$proxy) : void {
    $this->decorated
      ->setProxies(...$proxy);
  }

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

  /**
   * {@inheritdoc}
   */
  public function setQuota(string $quota) {
    $this->decorated
      ->setQuota($quota);
  }

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

  /**
   * {@inheritdoc}
   */
  public function setQuotaInterval(string $quota_interval) : void {
    $this->decorated
      ->setQuotaInterval($quota_interval);
  }

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

  /**
   * {@inheritdoc}
   */
  public function setQuotaTimeUnit(string $quota_time_unit) : void {
    $this->decorated
      ->setQuotaTimeUnit($quota_time_unit);
  }

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

  /**
   * {@inheritdoc}
   */
  public function setApprovalType(string $approval_type) : void {
    $this->decorated
      ->setApprovalType($approval_type);
  }

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

  /**
   * {@inheritdoc}
   */
  public function setApiResources(string ...$api_resources) : void {
    $this->decorated
      ->setApiResources($api_resources);
  }

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

  /**
   * {@inheritdoc}
   */
  public function setAttributes(AttributesProperty $attributes) : void {
    $this->decorated
      ->setAttributes($attributes);
  }

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

  /**
   * {@inheritdoc}
   */
  public function setAttribute(string $name, string $value) : void {
    $this->decorated
      ->setAttribute($name, $value);
  }

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

  /**
   * {@inheritdoc}
   */
  public function deleteAttribute(string $name) : void {
    $this->decorated
      ->deleteAttribute($name);
  }

  /**
   * {@inheritdoc}
   */
  public function getCreatedAt() : ?\DateTimeImmutable {
    return $this->decorated
      ->getCreatedAt();
  }

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

  /**
   * {@inheritdoc}
   */
  public function getLastModifiedAt() : ?\DateTimeImmutable {
    return $this->decorated
      ->getLastModifiedAt();
  }

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

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

  /**
   * {@inheritdoc}
   */
  public function setDescription(string $description) : void {
    $this->decorated
      ->setDescription($description);
  }

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

  /**
   * {@inheritdoc}
   */
  public function setDisplayName(string $display_name) : void {
    $this->decorated
      ->setDisplayName($display_name);
  }

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

  /**
   * {@inheritdoc}
   */
  public function setEnvironments(string ...$environments) : void {
    $this->decorated
      ->setEnvironments(...$environments);
  }

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

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

  /**
   * {@inheritdoc}
   */
  public function setScopes(string ...$scopes) : void {
    $this->decorated
      ->setScopes(...$scopes);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ApiProduct::decoratedClass protected static function The FQCN of the decorated class from the PHP API Client. Overrides EdgeEntityBase::decoratedClass
ApiProduct::deleteAttribute public function
ApiProduct::drupalEntityId protected function Return the entity id used in Drupal. Overrides EdgeEntityBase::drupalEntityId
ApiProduct::getApiResources public function
ApiProduct::getApprovalType public function
ApiProduct::getAttributes public function
ApiProduct::getAttributeValue public function
ApiProduct::getCreatedAt public function
ApiProduct::getCreatedBy public function
ApiProduct::getDescription public function
ApiProduct::getDisplayName public function
ApiProduct::getEnvironments public function
ApiProduct::getLastModifiedAt public function
ApiProduct::getLastModifiedBy public function
ApiProduct::getName public function
ApiProduct::getProxies public function
ApiProduct::getQuota public function
ApiProduct::getQuotaInterval public function
ApiProduct::getQuotaTimeUnit public function
ApiProduct::getScopes public function
ApiProduct::hasAttribute public function
ApiProduct::id public function We have to override this to make it compatible with the SDK's entity interface that has return type hint. Overrides EdgeEntityBase::id
ApiProduct::idProperty public static function
ApiProduct::setApiResources public function
ApiProduct::setApprovalType public function
ApiProduct::setAttribute public function
ApiProduct::setAttributes public function
ApiProduct::setDescription public function
ApiProduct::setDisplayName public function
ApiProduct::setEnvironments public function
ApiProduct::setProxies public function
ApiProduct::setQuota public function
ApiProduct::setQuotaInterval public function
ApiProduct::setQuotaTimeUnit public function
ApiProduct::setScopes public function
ApiProduct::__construct public function ApiProduct constructor. Overrides EdgeEntityBase::__construct
CacheableDependencyTrait::$cacheContexts protected property Cache contexts.
CacheableDependencyTrait::$cacheMaxAge protected property Cache max-age.
CacheableDependencyTrait::$cacheTags protected property Cache tags.
CacheableDependencyTrait::setCacheability protected function Sets cacheability; useful for value object constructors.
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function Aliased as: traitSleep 1
DependencySerializationTrait::__wakeup public function 2
EdgeEntityBase::$decorated protected property The decorated SDK entity. 2
EdgeEntityBase::createFrom public static function Creates a Drupal entity from an SDK Entity. Overrides EdgeEntityInterface::createFrom
EdgeEntityBase::decorated public function Returns the decorated SDK entity. Overrides EdgeEntityInterface::decorated 2
EdgeEntityBase::getTranslation public function
EdgeEntityBase::hasTranslation public function
EdgeEntityBase::isTranslatable public function
EdgeEntityBase::label public function Gets the label of the entity. Overrides EntityBase::label 2
EdgeEntityBase::uniqueIdProperties public static function Returns all unique ids how an entity can be referenced in Apigee Edge. Overrides EdgeEntityInterface::uniqueIdProperties 2
EdgeEntityBase::uniqueIds public function List of unique ids how an entity can be referenced in Apigee Edge. Overrides EdgeEntityInterface::uniqueIds
EntityBase::$enforceIsNew protected property Boolean indicating whether the entity should be forced to be new.
EntityBase::$entityTypeId protected property The entity type.
EntityBase::$typedData protected property A typed data object wrapping this entity.
EntityBase::access public function Checks data value access. Overrides AccessibleInterface::access 1
EntityBase::bundle public function Gets the bundle of the entity. Overrides EntityInterface::bundle 1
EntityBase::create public static function Constructs a new entity object, without permanently saving it. Overrides EntityInterface::create
EntityBase::createDuplicate public function Creates a duplicate of the entity. Overrides EntityInterface::createDuplicate 2
EntityBase::delete public function Deletes an entity permanently. Overrides EntityInterface::delete 2
EntityBase::enforceIsNew public function Enforces an entity to be new. Overrides EntityInterface::enforceIsNew
EntityBase::entityManager Deprecated protected function Gets the entity manager.
EntityBase::entityTypeBundleInfo protected function Gets the entity type bundle info service.
EntityBase::entityTypeManager protected function Gets the entity type manager.
EntityBase::getCacheContexts public function The cache contexts associated with this object. Overrides CacheableDependencyTrait::getCacheContexts
EntityBase::getCacheMaxAge public function The maximum age for which this object may be cached. Overrides CacheableDependencyTrait::getCacheMaxAge
EntityBase::getCacheTags public function The cache tags associated with this object. Overrides CacheableDependencyTrait::getCacheTags
EntityBase::getCacheTagsToInvalidate public function Returns the cache tags that should be used to invalidate caches. Overrides EntityInterface::getCacheTagsToInvalidate 2
EntityBase::getConfigDependencyKey public function Gets the key that is used to store configuration dependencies. Overrides EntityInterface::getConfigDependencyKey
EntityBase::getConfigDependencyName public function Gets the configuration dependency name. Overrides EntityInterface::getConfigDependencyName 1
EntityBase::getConfigTarget public function Gets the configuration target identifier for the entity. Overrides EntityInterface::getConfigTarget 1
EntityBase::getEntityType public function Gets the entity type definition. Overrides EntityInterface::getEntityType
EntityBase::getEntityTypeId public function Gets the ID of the type of the entity. Overrides EntityInterface::getEntityTypeId
EntityBase::getListCacheTagsToInvalidate protected function The list cache tags to invalidate for this entity.
EntityBase::getOriginalId public function Gets the original ID. Overrides EntityInterface::getOriginalId 1
EntityBase::getTypedData public function Gets a typed data object for this entity object. Overrides EntityInterface::getTypedData
EntityBase::hasLinkTemplate public function Indicates if a link template exists for a given key. Overrides EntityInterface::hasLinkTemplate
EntityBase::invalidateTagsOnDelete protected static function Invalidates an entity's cache tags upon delete. 1
EntityBase::invalidateTagsOnSave protected function Invalidates an entity's cache tags upon save. 1
EntityBase::isNew public function Determines whether the entity is new. Overrides EntityInterface::isNew 2
EntityBase::language public function Gets the language of the entity. Overrides EntityInterface::language 1
EntityBase::languageManager protected function Gets the language manager.
EntityBase::link public function Deprecated way of generating a link to the entity. See toLink(). Overrides EntityInterface::link 1
EntityBase::linkTemplates protected function Gets an array link templates. 1
EntityBase::load public static function Loads an entity. Overrides EntityInterface::load
EntityBase::loadMultiple public static function Loads one or more entities. Overrides EntityInterface::loadMultiple
EntityBase::postCreate public function Acts on a created entity before hooks are invoked. Overrides EntityInterface::postCreate 4
EntityBase::postDelete public static function Acts on deleted entities before the delete hook is invoked. Overrides EntityInterface::postDelete 16
EntityBase::postLoad public static function Acts on loaded entities. Overrides EntityInterface::postLoad 2
EntityBase::postSave public function Acts on a saved entity before the insert or update hook is invoked. Overrides EntityInterface::postSave 14
EntityBase::preCreate public static function Changes the values of an entity before it is created. Overrides EntityInterface::preCreate 5
EntityBase::preDelete public static function Acts on entities before they are deleted and before hooks are invoked. Overrides EntityInterface::preDelete 4
EntityBase::preSave public function Acts on an entity before the presave hook is invoked. Overrides EntityInterface::preSave 2
EntityBase::referencedEntities public function Gets a list of entities referenced by this entity. Overrides EntityInterface::referencedEntities 1
EntityBase::save public function Saves an entity permanently. Overrides EntityInterface::save 3
EntityBase::setOriginalId public function Sets the original ID. Overrides EntityInterface::setOriginalId 1
EntityBase::toArray public function Gets an array of all property values. Overrides EntityInterface::toArray 2
EntityBase::toLink public function Generates the HTML for a link to this entity. Overrides EntityInterface::toLink
EntityBase::toUrl public function Gets the URL object for the entity. Overrides EntityInterface::toUrl 2
EntityBase::uriRelationships public function Gets a list of URI relationships supported by this entity. Overrides EntityInterface::uriRelationships
EntityBase::url public function Gets the public URL for this entity. Overrides EntityInterface::url 2
EntityBase::urlInfo public function Gets the URL object for the entity. Overrides EntityInterface::urlInfo 1
EntityBase::urlRouteParameters protected function Gets an array of placeholders for this entity. 2
EntityBase::uuid public function Gets the entity UUID (Universally Unique Identifier). Overrides EntityInterface::uuid 1
EntityBase::uuidGenerator protected function Gets the UUID generator.
EntityBase::__sleep public function 2
RefinableCacheableDependencyTrait::addCacheableDependency public function 1
RefinableCacheableDependencyTrait::addCacheContexts public function
RefinableCacheableDependencyTrait::addCacheTags public function
RefinableCacheableDependencyTrait::mergeCacheMaxAge public function
RevisioningWorkaroundTrait::getLoadedRevisionId public function
RevisioningWorkaroundTrait::getRevisionId public function
RevisioningWorkaroundTrait::isDefaultRevision public function
RevisioningWorkaroundTrait::isLatestRevision public function
RevisioningWorkaroundTrait::isNewRevision public function
RevisioningWorkaroundTrait::preSaveRevision public function
RevisioningWorkaroundTrait::setNewRevision public function
RevisioningWorkaroundTrait::updateLoadedRevisionId public function
RevisioningWorkaroundTrait::wasDefaultRevision public function