protected function AppStorage::initFieldValues in Apigee Edge 8
Initializes field values.
Parameters
\Drupal\apigee_edge\Entity\FieldableEdgeEntityInterface $entity: An entity object.
array $values: (optional) An associative array of initial field values keyed by field name. If none is provided default values will be applied.
array $field_names: (optional) An associative array of field names to be initialized. If none is provided all fields will be initialized.
Overrides FieldableEdgeEntityStorageBase::initFieldValues
See also
\Drupal\Core\Entity\ContentEntityStorageBase::initFieldValues()
File
- src/
Entity/ Storage/ AppStorage.php, line 124
Class
- AppStorage
- Base entity storage class for developer and team (company) app entities.
Namespace
Drupal\apigee_edge\Entity\StorageCode
protected function initFieldValues(FieldableEdgeEntityInterface $entity, array $values = [], array $field_names = []) {
// Initialize display name and description field's value from the display
// name attribute if needed.
// @see \Apigee\Edge\Api\Management\Entity\App::getDisplayName()
if (!array_key_exists('displayName', $values) && array_key_exists('attributes', $values) && $values['attributes']
->has('DisplayName')) {
$values['displayName'] = $values['attributes']
->getValue('DisplayName');
}
// @see \Apigee\Edge\Api\Management\Entity\App::getDescription()
if (!array_key_exists('description', $values) && array_key_exists('attributes', $values) && $values['attributes']
->has('Notes')) {
$values['description'] = $values['attributes']
->getValue('Notes');
}
parent::initFieldValues($entity, $values, $field_names);
}