protected function ConfigStorageController::getProperties

Retrieves the exportable properties of an entity.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity being saved.

Return value

array An array of exportable properties and their values.

See also

\Drupal\Core\Config\Entity\ConfigStorageController::save()

1 call to ConfigStorageController::getProperties()
1 method overrides ConfigStorageController::getProperties()

File

drupal/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php, line 349
Definition of Drupal\Core\Config\Entity\ConfigStorageController.

Class

ConfigStorageController
Defines the storage controller class for configuration entities.

Namespace

Drupal\Core\Config\Entity

Code

protected function getProperties(EntityInterface $entity) {

  // Configuration objects do not have a schema. Extract all key names from
  // class properties.
  $class_info = new \ReflectionClass($entity);
  $properties = array();
  foreach ($class_info
    ->getProperties(\ReflectionProperty::IS_PUBLIC) as $property) {
    $name = $property
      ->getName();
    $properties[$name] = $entity->{$name};
  }
  return $properties;
}