Retrieves the exportable properties of an entity.
\Drupal\Core\Entity\EntityInterface $entity: The entity being saved.
array An array of exportable properties and their values.
\Drupal\Core\Config\Entity\ConfigStorageController::save()
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;
}