You are here

public function AppCredentialControllerBase::addProducts in Apigee Edge 8

File

src/Entity/Controller/AppCredentialControllerBase.php, line 118

Class

AppCredentialControllerBase
Base class for developer- and company app credential controller services.

Namespace

Drupal\apigee_edge\Entity\Controller

Code

public function addProducts(string $consumer_key, array $api_products) : AppCredentialInterface {
  $credential = $this
    ->decorated()
    ->addProducts($consumer_key, $api_products);
  $this->eventDispatcher
    ->dispatch(AppCredentialAddApiProductEvent::EVENT_NAME, new AppCredentialAddApiProductEvent($this
    ->getAppType(), $this->owner, $this->appName, $credential, $api_products));

  // By removing app from cache we force reload the credentials as well.
  $this->appCacheByOwner
    ->removeEntities([
    $this->appName,
  ]);
  return $credential;
}