public function TeamController::delete in Apigee Edge 8
File
- modules/
apigee_edge_teams/ src/ Entity/ Controller/ TeamController.php, line 198
Class
- TeamController
- Definition of the Team controller service.
Namespace
Drupal\apigee_edge_teams\Entity\ControllerCode
public function delete(string $entity_id) : EntityInterface {
/** @var \Apigee\Edge\Api\Management\Entity\CompanyInterface $entity */
$entity = $this
->traitDelete($entity_id);
// Invalidate developer companies cache to force reload
// in \Drupal\apigee_edge\Entity\Developer::getCompanies().
$this->developerCompaniesCache
->invalidate([
"company:{$entity_id}",
]);
// And of course, the company membership object cache has to be cleared as
// well.
$this->companyMembershipObjectCache
->removeMembership($entity_id);
// Invalidate app caches that belongs to this company.
$app_cache = $this->appCacheByOwnerFactory
->getAppCache($entity
->id());
$app_ids = [];
/** @var \Apigee\Edge\Api\Management\Entity\CompanyAppInterface $app */
foreach ($app_cache
->getEntities() as $app) {
$app_ids[] = $app
->getAppId();
}
$app_cache
->removeEntities($app_ids);
// App cache has cleared all app names that it knows about
// but it could happen that there are some remaining app names in the
// app name cache that has not be created by app cache.
$app_name_cache = $this->appNameCacheByOwnerFactory
->getAppNameCache($entity
->id());
$app_name_cache
->removeIds($app_name_cache
->getIds());
return $entity;
}