class Team in Apigee Edge 8
Defines the Team entity class.
@\Drupal\apigee_edge\Annotation\EdgeEntityType( id = "team", label =
Plugin annotation
@Translation("Team"),
label_collection = @Translation("Teams"),
label_singular = @Translation("team"),
label_plural = @Translation("teams"),
label_count = @PluralTranslation(
singular = "@count team",
plural = "@count teams",
),
config_with_labels = "apigee_edge_teams.team_settings",
handlers = {
"storage" = "Drupal\apigee_edge_teams\Entity\Storage\TeamStorage",
"permission_provider" = "Drupal\apigee_edge_teams\Entity\TeamPermissionProvider",
"access" = "Drupal\apigee_edge_teams\Entity\TeamAccessHandler",
"list_builder" = "Drupal\apigee_edge_teams\Entity\ListBuilder\TeamListBuilder",
"view_builder" = "Drupal\apigee_edge_teams\Entity\TeamViewBuilder",
"form" = {
"default" = "Drupal\apigee_edge_teams\Entity\Form\TeamForm",
"add" = "Drupal\apigee_edge_teams\Entity\Form\TeamForm",
"delete" = "Drupal\apigee_edge_teams\Entity\Form\TeamDeleteForm",
},
"route_provider" = {
"default" = "Drupal\apigee_edge_teams\Entity\TeamRouteProvider",
},
},
links = {
"collection" = "/teams",
"canonical" = "/teams/{team}",
"add-form" = "/add-team",
"edit-form" = "/teams/{team}/edit",
"delete-form" = "/teams/{team}/delete",
"members" = "/teams/{team}/members",
"add-members" = "/teams/{team}/add-members",
},
entity_keys = {
"id" = "name",
"label" = "displayName",
},
admin_permission = "administer team",
field_ui_base_route = "apigee_edge_teams.settings.team",
)
Hierarchy
- class \Drupal\Core\Entity\EntityBase implements EntityInterface uses RefinableCacheableDependencyTrait, DependencySerializationTrait
- class \Drupal\apigee_edge\Entity\EdgeEntityBase implements EdgeEntityInterface
- class \Drupal\apigee_edge\Entity\FieldableEdgeEntityBase implements FieldableEdgeEntityInterface uses RevisioningWorkaroundTrait
- class \Drupal\apigee_edge\Entity\AttributesAwareFieldableEdgeEntityBase implements AttributesAwareFieldableEdgeEntityBaseInterface
- class \Drupal\apigee_edge_teams\Entity\Team implements TeamInterface
- class \Drupal\apigee_edge\Entity\AttributesAwareFieldableEdgeEntityBase implements AttributesAwareFieldableEdgeEntityBaseInterface
- class \Drupal\apigee_edge\Entity\FieldableEdgeEntityBase implements FieldableEdgeEntityInterface uses RevisioningWorkaroundTrait
- class \Drupal\apigee_edge\Entity\EdgeEntityBase implements EdgeEntityInterface
Expanded class hierarchy of Team
2 files declare their use of Team
- ApigeeMockApiClientHelperTrait.php in tests/
modules/ apigee_mock_api_client/ tests/ src/ Traits/ ApigeeMockApiClientHelperTrait.php - TeamInvitationEventsTest.php in modules/
apigee_edge_teams/ tests/ src/ Kernel/ Event/ TeamInvitationEventsTest.php
5 string references to 'Team'
- DefaultTeamPermissionsProvider::permissions in modules/
apigee_edge_teams/ src/ DefaultTeamPermissionsProvider.php - Returns team permissions provided by a module.
- EdgeEntityEventDeriverBase::getContext in modules/
apigee_edge_actions/ src/ Plugin/ RulesEvent/ EdgeEntityEventDeriverBase.php - Returns an array of event context.
- TeamAliasForm::entityTypeName in modules/
apigee_edge_teams/ src/ Form/ TeamAliasForm.php - Returns the human readable name of the entity.
- TeamAliasForm::originalSingularLabel in modules/
apigee_edge_teams/ src/ Form/ TeamAliasForm.php - Returns the original singular label of the entity.
- views.view.team_invitations.yml in modules/
apigee_edge_teams/ config/ optional/ views.view.team_invitations.yml - modules/apigee_edge_teams/config/optional/views.view.team_invitations.yml
File
- modules/
apigee_edge_teams/ src/ Entity/ Team.php, line 75
Namespace
Drupal\apigee_edge_teams\EntityView source
class Team extends AttributesAwareFieldableEdgeEntityBase implements TeamInterface {
/**
* The decorated company entity from the SDK.
*
* @var \Apigee\Edge\Api\Management\Entity\Company
*/
protected $decorated;
/**
* Team 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, ?EntityInterface $decorated = NULL) {
$entity_type = $entity_type ?? 'team';
// Callers expect that the status is always either 'active' or 'inactive',
// never null.
if (!isset($values['status'])) {
$values['status'] = static::STATUS_ACTIVE;
}
parent::__construct($values, $entity_type, $decorated);
}
/**
* {@inheritdoc}
*/
protected static function decoratedClass() : string {
return Company::class;
}
/**
* We have to override this.
*
* This is how we could make it compatible with the SDK's
* entity interface that has return type hint.
*/
public function id() : ?string {
return parent::id();
}
/**
* {@inheritdoc}
*/
public static function idProperty() : string {
return Company::idProperty();
}
/**
* {@inheritdoc}
*/
protected function drupalEntityId() : ?string {
return $this->decorated
->id();
}
/**
* {@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 getApps() : array {
return $this->decorated
->getApps();
}
/**
* {@inheritdoc}
*/
public function hasApp(string $app_name) : bool {
return $this->decorated
->hasApp($app_name);
}
/**
* {@inheritdoc}
*/
public function setOrganization(string $organization) : void {
$this->decorated
->setOrganization($organization);
}
/**
* {@inheritdoc}
*/
public function getOrganization() : ?string {
return $this->decorated
->getOrganization();
}
/**
* {@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 getName() : ?string {
return $this->decorated
->getName();
}
/**
* {@inheritdoc}
*/
public function getStatus() : ?string {
return $this->decorated
->getStatus();
}
/**
* {@inheritdoc}
*/
public function setStatus(string $status) : void {
$this->decorated
->setStatus($status);
}
/**
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
/** @var \Drupal\Core\Field\BaseFieldDefinition[] $definitions */
$definitions = parent::baseFieldDefinitions($entity_type);
$team_singular_label = \Drupal::entityTypeManager()
->getDefinition('team')
->getSingularLabel();
$team_singular_label = mb_convert_case($team_singular_label, MB_CASE_TITLE);
$definitions['displayName']
->setDisplayOptions('view', [
'label' => 'inline',
'weight' => 0,
])
->setDisplayOptions('form', [
'weight' => 0,
])
->setLabel(t("@team name", [
'@team' => $team_singular_label,
]))
->setRequired(TRUE);
$definitions['status']
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'status_property',
'weight' => 2,
])
->setLabel(t('@team status', [
'@team' => $team_singular_label,
]))
->setDisplayConfigurable('form', FALSE);
$definitions['createdAt']
->setDisplayOptions('view', [
'type' => 'timestamp_ago',
'label' => 'inline',
'weight' => 3,
])
->setLabel(t('Created'))
->setDisplayConfigurable('form', FALSE);
$definitions['lastModifiedAt']
->setDisplayOptions('view', [
'type' => 'timestamp_ago',
'label' => 'inline',
'weight' => 5,
])
->setLabel(t('Last updated'))
->setDisplayConfigurable('form', FALSE);
$definitions['name']
->setLabel(t('@team id', [
'@team' => $team_singular_label,
]))
->setDisplayConfigurable('form', FALSE)
->setRequired(TRUE);
return $definitions;
}
/**
* {@inheritdoc}
*/
protected static function propertyToBaseFieldTypeMap() : array {
return parent::propertyToBaseFieldTypeMap() + [
'status' => 'string',
];
}
/**
* {@inheritdoc}
*/
protected static function propertyToBaseFieldBlackList() : array {
return array_merge(parent::propertyToBaseFieldBlackList(), [
// Apps only contains app names (not display names), we do not want to
// expose them by default.
'apps',
// There is no need to expose the organization that the team (company)
// belongs.
'organization',
]);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AttributesAwareFieldableEdgeEntityBase:: |
protected | function | Returns the field-attribute converter service. | |
AttributesAwareFieldableEdgeEntityBase:: |
public | function |
Gets a field item list. Overrides FieldableEdgeEntityBase:: |
1 |
AttributesAwareFieldableEdgeEntityBase:: |
private | function | Sets attribute value from a field. | |
AttributesAwareFieldableEdgeEntityBase:: |
public | function |
Updates the property value on an entity by field name. Overrides FieldableEdgeEntityBase:: |
|
CacheableDependencyTrait:: |
protected | property | Cache contexts. | |
CacheableDependencyTrait:: |
protected | property | Cache max-age. | |
CacheableDependencyTrait:: |
protected | property | Cache tags. | |
CacheableDependencyTrait:: |
protected | function | Sets cacheability; useful for value object constructors. | |
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | Aliased as: traitSleep | 1 |
DependencySerializationTrait:: |
public | function | 2 | |
EdgeEntityBase:: |
public static | function |
Creates a Drupal entity from an SDK Entity. Overrides EdgeEntityInterface:: |
|
EdgeEntityBase:: |
public | function |
Returns the decorated SDK entity. Overrides EdgeEntityInterface:: |
2 |
EdgeEntityBase:: |
public | function | ||
EdgeEntityBase:: |
public | function | ||
EdgeEntityBase:: |
public | function | ||
EdgeEntityBase:: |
public | function |
Gets the label of the entity. Overrides EntityBase:: |
2 |
EdgeEntityBase:: |
public static | function |
Returns all unique ids how an entity can be referenced in Apigee Edge. Overrides EdgeEntityInterface:: |
2 |
EdgeEntityBase:: |
public | function |
List of unique ids how an entity can be referenced in Apigee Edge. Overrides EdgeEntityInterface:: |
|
EntityBase:: |
protected | property | Boolean indicating whether the entity should be forced to be new. | |
EntityBase:: |
protected | property | The entity type. | |
EntityBase:: |
protected | property | A typed data object wrapping this entity. | |
EntityBase:: |
public | function |
Checks data value access. Overrides AccessibleInterface:: |
1 |
EntityBase:: |
public | function |
Gets the bundle of the entity. Overrides EntityInterface:: |
1 |
EntityBase:: |
public static | function |
Constructs a new entity object, without permanently saving it. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Creates a duplicate of the entity. Overrides EntityInterface:: |
2 |
EntityBase:: |
public | function |
Deletes an entity permanently. Overrides EntityInterface:: |
2 |
EntityBase:: |
public | function |
Enforces an entity to be new. Overrides EntityInterface:: |
|
EntityBase:: |
protected | function | Gets the entity manager. | |
EntityBase:: |
protected | function | Gets the entity type bundle info service. | |
EntityBase:: |
protected | function | Gets the entity type manager. | |
EntityBase:: |
public | function |
The cache contexts associated with this object. Overrides CacheableDependencyTrait:: |
|
EntityBase:: |
public | function |
The maximum age for which this object may be cached. Overrides CacheableDependencyTrait:: |
|
EntityBase:: |
public | function |
The cache tags associated with this object. Overrides CacheableDependencyTrait:: |
|
EntityBase:: |
public | function |
Returns the cache tags that should be used to invalidate caches. Overrides EntityInterface:: |
2 |
EntityBase:: |
public | function |
Gets the key that is used to store configuration dependencies. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Gets the configuration dependency name. Overrides EntityInterface:: |
1 |
EntityBase:: |
public | function |
Gets the configuration target identifier for the entity. Overrides EntityInterface:: |
1 |
EntityBase:: |
public | function |
Gets the entity type definition. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Gets the ID of the type of the entity. Overrides EntityInterface:: |
|
EntityBase:: |
protected | function | The list cache tags to invalidate for this entity. | |
EntityBase:: |
public | function |
Gets the original ID. Overrides EntityInterface:: |
1 |
EntityBase:: |
public | function |
Gets a typed data object for this entity object. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Indicates if a link template exists for a given key. Overrides EntityInterface:: |
|
EntityBase:: |
protected static | function | Invalidates an entity's cache tags upon delete. | 1 |
EntityBase:: |
protected | function | Invalidates an entity's cache tags upon save. | 1 |
EntityBase:: |
public | function |
Determines whether the entity is new. Overrides EntityInterface:: |
2 |
EntityBase:: |
public | function |
Gets the language of the entity. Overrides EntityInterface:: |
1 |
EntityBase:: |
protected | function | Gets the language manager. | |
EntityBase:: |
public | function |
Deprecated way of generating a link to the entity. See toLink(). Overrides EntityInterface:: |
1 |
EntityBase:: |
protected | function | Gets an array link templates. | 1 |
EntityBase:: |
public static | function |
Loads an entity. Overrides EntityInterface:: |
|
EntityBase:: |
public static | function |
Loads one or more entities. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Acts on a created entity before hooks are invoked. Overrides EntityInterface:: |
4 |
EntityBase:: |
public static | function |
Acts on deleted entities before the delete hook is invoked. Overrides EntityInterface:: |
16 |
EntityBase:: |
public static | function |
Acts on loaded entities. Overrides EntityInterface:: |
2 |
EntityBase:: |
public static | function |
Changes the values of an entity before it is created. Overrides EntityInterface:: |
5 |
EntityBase:: |
public static | function |
Acts on entities before they are deleted and before hooks are invoked. Overrides EntityInterface:: |
4 |
EntityBase:: |
public | function |
Acts on an entity before the presave hook is invoked. Overrides EntityInterface:: |
2 |
EntityBase:: |
public | function |
Gets a list of entities referenced by this entity. Overrides EntityInterface:: |
1 |
EntityBase:: |
public | function |
Saves an entity permanently. Overrides EntityInterface:: |
3 |
EntityBase:: |
public | function |
Sets the original ID. Overrides EntityInterface:: |
1 |
EntityBase:: |
public | function |
Generates the HTML for a link to this entity. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Gets the URL object for the entity. Overrides EntityInterface:: |
2 |
EntityBase:: |
public | function |
Gets a list of URI relationships supported by this entity. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Gets the public URL for this entity. Overrides EntityInterface:: |
2 |
EntityBase:: |
public | function |
Gets the URL object for the entity. Overrides EntityInterface:: |
1 |
EntityBase:: |
protected | function | Gets an array of placeholders for this entity. | 2 |
EntityBase:: |
public | function |
Gets the entity UUID (Universally Unique Identifier). Overrides EntityInterface:: |
1 |
EntityBase:: |
protected | function | Gets the UUID generator. | |
FieldableEdgeEntityBase:: |
protected | property | Local cache for field definitions. | |
FieldableEdgeEntityBase:: |
protected | property | Local cache for for fields. | |
FieldableEdgeEntityBase:: |
protected | property | Whether entity validation was performed. | |
FieldableEdgeEntityBase:: |
protected | property | Whether entity validation is required before saving the entity. | |
FieldableEdgeEntityBase:: |
public static | function |
Provides field definitions for a specific bundle. Overrides FieldableEntityInterface:: |
|
FieldableEdgeEntityBase:: |
protected | function | Converts a field value to a property value. | |
FieldableEdgeEntityBase:: |
private static | function | Returns whether an entity property is blacklisted to be exposed as field. | |
FieldableEdgeEntityBase:: |
protected static | function | Attempts to create a base field definition from a type. | |
FieldableEdgeEntityBase:: |
public | function |
Gets the definition of a contained field. Overrides FieldableEntityInterface:: |
|
FieldableEdgeEntityBase:: |
public | function |
Gets an array of field definitions of all contained fields. Overrides FieldableEntityInterface:: |
|
FieldableEdgeEntityBase:: |
public | function |
Gets an array of all field item lists. Overrides FieldableEntityInterface:: |
|
FieldableEdgeEntityBase:: |
protected | function | Returns the field value from the current object. | |
FieldableEdgeEntityBase:: |
public | function | ||
FieldableEdgeEntityBase:: |
protected static | function | Parses the properties and its types from the parent class. | |
FieldableEdgeEntityBase:: |
public | function |
Gets an array of field item lists for translatable fields. Overrides FieldableEntityInterface:: |
|
FieldableEdgeEntityBase:: |
public | function |
Determines whether the entity has a field with the given name. Overrides FieldableEntityInterface:: |
|
FieldableEdgeEntityBase:: |
public | function |
Checks whether entity validation is required before saving the entity. Overrides FieldableEntityInterface:: |
|
FieldableEdgeEntityBase:: |
public | function |
Reacts to changes to a field. Overrides FieldableEntityInterface:: |
|
FieldableEdgeEntityBase:: |
public | function |
Acts on a saved entity before the insert or update hook is invoked. Overrides EntityBase:: |
|
FieldableEdgeEntityBase:: |
private static | function | Returns the type of the field that should represent an entity property. | |
FieldableEdgeEntityBase:: |
public | function |
Sets a field value. Overrides FieldableEntityInterface:: |
1 |
FieldableEdgeEntityBase:: |
public | function |
Sets whether entity validation is required before saving the entity. Overrides FieldableEntityInterface:: |
|
FieldableEdgeEntityBase:: |
public | function |
Gets an array of all property values. Overrides EntityBase:: |
|
FieldableEdgeEntityBase:: |
public | function |
Validates the currently set values. Overrides FieldableEntityInterface:: |
|
FieldableEdgeEntityBase:: |
public | function |
Overrides EntityBase:: |
|
RefinableCacheableDependencyTrait:: |
public | function | 1 | |
RefinableCacheableDependencyTrait:: |
public | function | ||
RefinableCacheableDependencyTrait:: |
public | function | ||
RefinableCacheableDependencyTrait:: |
public | function | ||
RevisioningWorkaroundTrait:: |
public | function | ||
RevisioningWorkaroundTrait:: |
public | function | ||
RevisioningWorkaroundTrait:: |
public | function | ||
RevisioningWorkaroundTrait:: |
public | function | ||
RevisioningWorkaroundTrait:: |
public | function | ||
RevisioningWorkaroundTrait:: |
public | function | ||
RevisioningWorkaroundTrait:: |
public | function | ||
RevisioningWorkaroundTrait:: |
public | function | ||
RevisioningWorkaroundTrait:: |
public | function | ||
Team:: |
protected | property |
The decorated company entity from the SDK. Overrides AttributesAwareFieldableEdgeEntityBase:: |
|
Team:: |
public static | function |
Provides base field definitions for an entity type. Overrides FieldableEdgeEntityBase:: |
|
Team:: |
protected static | function |
The FQCN of the decorated class from the PHP API Client. Overrides EdgeEntityBase:: |
|
Team:: |
public | function | ||
Team:: |
protected | function |
Return the entity id used in Drupal. Overrides EdgeEntityBase:: |
|
Team:: |
public | function | ||
Team:: |
public | function | ||
Team:: |
public | function | ||
Team:: |
public | function | ||
Team:: |
public | function | ||
Team:: |
public | function | ||
Team:: |
public | function | ||
Team:: |
public | function | ||
Team:: |
public | function | ||
Team:: |
public | function | ||
Team:: |
public | function | ||
Team:: |
public | function | ||
Team:: |
public | function | ||
Team:: |
public | function |
We have to override this. Overrides EdgeEntityBase:: |
|
Team:: |
public static | function | ||
Team:: |
protected static | function |
Array of properties that should not be exposed as base fields by default. Overrides FieldableEdgeEntityBase:: |
|
Team:: |
protected static | function |
Static mapping between entity properties and Drupal field types. Overrides FieldableEdgeEntityBase:: |
|
Team:: |
public | function | ||
Team:: |
public | function | ||
Team:: |
public | function | ||
Team:: |
public | function | ||
Team:: |
public | function |
Set status of the team. Overrides TeamInterface:: |
|
Team:: |
public | function |
Team constructor. Overrides AttributesAwareFieldableEdgeEntityBase:: |