Commit 23902766 authored by webchick's avatar webchick

Issue #2219925 by tim.plunkett: Rename ConfigEntityInterface::getExportProperties() to toArray().

parent 032c3986
......@@ -198,7 +198,7 @@ public static function sort($a, $b) {
/**
* {@inheritdoc}
*/
public function getExportProperties() {
public function toArray() {
// Configuration objects do not have a schema. Extract all key names from
// class properties.
$class_info = new \ReflectionClass($this);
......
......@@ -120,6 +120,6 @@ public function set($property_name, $value);
* @return array
* An array of exportable properties and their values.
*/
public function getExportProperties();
public function toArray();
}
......@@ -328,7 +328,7 @@ public function save(EntityInterface $entity) {
}
// Retrieve the desired properties and set them in config.
foreach ($entity->getExportProperties() as $key => $value) {
foreach ($entity->toArray() as $key => $value) {
$config->set($key, $value);
}
......
......@@ -127,10 +127,10 @@ public function label() {
}
/**
* Overrides \Drupal\Core\Config\Entity\ConfigEntityBase::getExportProperties();
* {@inheritdoc}
*/
public function getExportProperties() {
$properties = parent::getExportProperties();
public function toArray() {
$properties = parent::toArray();
$names = array(
'theme',
'region',
......
......@@ -196,7 +196,7 @@ public function getBreakpointById($id) {
/**
* {@inheritdoc}
*/
public function getExportProperties() {
public function toArray() {
$names = array(
'id',
'uuid',
......
......@@ -40,7 +40,7 @@ public function testUUIDConflict() {
entity_create($entity_type, array('id' => $id))->save();
$entity = entity_load($entity_type, $id);
$original_properties = $entity->getExportProperties();
$original_properties = $entity->toArray();
// Override with a new UUID and try to save.
$new_uuid = $this->container->get('uuid')->generate();
......@@ -56,7 +56,7 @@ public function testUUIDConflict() {
// Ensure that the config entity was not corrupted.
$entity = entity_load('config_test', $entity->id(), TRUE);
$this->assertIdentical($entity->getExportProperties(), $original_properties);
$this->assertIdentical($entity->toArray(), $original_properties);
}
}
......@@ -144,7 +144,7 @@ public function testExport() {
$this->assertFieldByXPath('//select[@name="config_name"]//option[@selected="selected"]', t('Fallback date format'), 'The fallback date format config entity is selected when specified in the URL.');
$fallback_date = \Drupal::entityManager()->getStorageController('date_format')->load('fallback');
$data = \Drupal::service('config.storage')->encode($fallback_date->getExportProperties());
$data = \Drupal::service('config.storage')->encode($fallback_date->toArray());
$this->assertFieldByXPath('//textarea[@name="export"]', $data, 'The fallback date format config entity export code is displayed.');
}
......
......@@ -77,10 +77,10 @@ class ConfigTest extends ConfigEntityBase implements ConfigTestInterface {
protected $protected_property;
/**
* Overrides \Drupal\Core\Config\Entity\ConfigEntityBase::getExportProperties();
* {@inheritdoc}
*/
public function getExportProperties() {
$properties = parent::getExportProperties();
public function toArray() {
$properties = parent::toArray();
$protected_names = array(
'protected_property',
);
......
......@@ -149,7 +149,7 @@ public function getRenderer($field_name) {
*/
public function __sleep() {
// Only store the definition, not external objects or derived data.
$keys = array_keys($this->getExportProperties());
$keys = array_keys($this->toArray());
$keys[] = 'entityTypeId';
return $keys;
}
......@@ -158,8 +158,8 @@ public function __sleep() {
* {@inheritdoc}
*/
public function __wakeup() {
// Run the values from getExportProperties() through __construct().
$values = array_intersect_key($this->getExportProperties(), get_object_vars($this));
// Run the values from self::toArray() through __construct().
$values = array_intersect_key($this->toArray(), get_object_vars($this));
$this->__construct($values, $this->entityTypeId);
}
......
......@@ -158,7 +158,7 @@ public function postSave(EntityStorageControllerInterface $storage_controller, $
/**
* {@inheritdoc}
*/
public function getExportProperties() {
public function toArray() {
$names = array(
'id',
'uuid',
......
......@@ -237,7 +237,7 @@ public function id() {
/**
* {@inheritdoc}
*/
public function getExportProperties() {
public function toArray() {
$names = array(
'id',
'uuid',
......@@ -409,7 +409,7 @@ public static function preDelete(EntityStorageControllerInterface $storage_contr
$deleted_fields = $state->get('field.field.deleted') ?: array();
foreach ($fields as $field) {
if (!$field->deleted) {
$config = $field->getExportProperties();
$config = $field->toArray();
$config['deleted'] = TRUE;
$config['bundles'] = $field->getBundles();
$deleted_fields[$field->uuid] = $config;
......@@ -693,16 +693,16 @@ public function hasData() {
* @todo Investigate in https://drupal.org/node/2074253.
*/
public function __sleep() {
// Only serialize properties from getExportProperties().
return array_keys(array_intersect_key($this->getExportProperties(), get_object_vars($this)));
// Only serialize properties from self::toArray().
return array_keys(array_intersect_key($this->toArray(), get_object_vars($this)));
}
/**
* Implements the magic __wakeup() method.
*/
public function __wakeup() {
// Run the values from getExportProperties() through __construct().
$values = array_intersect_key($this->getExportProperties(), get_object_vars($this));
// Run the values from self::toArray() through __construct().
$values = array_intersect_key($this->toArray(), get_object_vars($this));
$this->__construct($values);
}
......
......@@ -259,7 +259,7 @@ public function __construct(array $values, $entity_type = 'field_instance_config
$this->field = $field;
// Discard the 'field_type' entry that is added in config records to ease
// schema generation. See getExportProperties().
// schema generation. See self::toArray().
unset($values['field_type']);
// Check required properties.
......@@ -288,7 +288,7 @@ public function id() {
/**
* {@inheritdoc}
*/
public function getExportProperties() {
public function toArray() {
$names = array(
'id',
'uuid',
......@@ -381,7 +381,7 @@ public static function preDelete(EntityStorageControllerInterface $storage_contr
$deleted_instances = $state->get('field.instance.deleted') ?: array();
foreach ($instances as $instance) {
if (!$instance->deleted) {
$config = $instance->getExportProperties();
$config = $instance->toArray();
$config['deleted'] = TRUE;
$deleted_instances[$instance->uuid] = $config;
}
......@@ -619,16 +619,16 @@ public function targetBundle() {
* @todo Investigate in https://drupal.org/node/2074253.
*/
public function __sleep() {
// Only serialize properties from getExportProperties().
return array_keys(array_intersect_key($this->getExportProperties(), get_object_vars($this)));
// Only serialize properties from self::toArray().
return array_keys(array_intersect_key($this->toArray(), get_object_vars($this)));
}
/**
* Implements the magic __wakeup() method.
*/
public function __wakeup() {
// Run the values from getExportProperties() through __construct().
$values = array_intersect_key($this->getExportProperties(), get_object_vars($this));
// Run the values from self::toArray() through __construct().
$values = array_intersect_key($this->toArray(), get_object_vars($this));
$this->__construct($values);
}
......
......@@ -173,8 +173,8 @@ public function setFilterConfig($instance_id, array $configuration) {
/**
* {@inheritdoc}
*/
public function getExportProperties() {
$properties = parent::getExportProperties();
public function toArray() {
$properties = parent::toArray();
// @todo Make self::$weight and self::$cache protected and add them here.
$names = array(
'filters',
......
......@@ -369,8 +369,8 @@ public function saveImageEffect(array $configuration) {
/**
* {@inheritdoc}
*/
public function getExportProperties() {
$properties = parent::getExportProperties();
public function toArray() {
$properties = parent::toArray();
$names = array(
'effects',
);
......
......@@ -136,7 +136,7 @@ public function id() {
/**
* {@inheritdoc}
*/
public function getExportProperties() {
public function toArray() {
$names = array(
'id',
'uuid',
......
......@@ -163,8 +163,8 @@ public function getWeight() {
/**
* {@inheritdoc}
*/
public function getExportProperties() {
$properties = parent::getExportProperties();
public function toArray() {
$properties = parent::toArray();
$names = array(
'path',
'weight',
......
......@@ -23,7 +23,7 @@ class ConfigEntityNormalizer extends EntityNormalizer {
* {@inheritdoc}
*/
public function normalize($object, $format = NULL, array $context = array()) {
return $object->getExportProperties();
return $object->toArray();
}
}
......@@ -43,7 +43,7 @@ public function testNormalize() {
$config_entity = $this->getMock('Drupal\Core\Config\Entity\ConfigEntityInterface');
$config_entity->expects($this->once())
->method('getExportProperties')
->method('toArray')
->will($this->returnValue($test_export_properties));
$this->assertSame($test_export_properties, $normalizer->normalize($config_entity));
......
......@@ -143,8 +143,8 @@ public static function sort($a, $b) {
/**
* {@inheritdoc}
*/
public function getExportProperties() {
$properties = parent::getExportProperties();
public function toArray() {
$properties = parent::toArray();
$names = array(
'type',
'plugin',
......
......@@ -71,8 +71,8 @@ class DateFormat extends ConfigEntityBase implements DateFormatInterface {
/**
* {@inheritdoc}
*/
public function getExportProperties() {
$properties = parent::getExportProperties();
public function toArray() {
$properties = parent::toArray();
$names = array(
'locked',
'pattern',
......
......@@ -61,8 +61,8 @@ class Menu extends ConfigEntityBase implements MenuInterface {
/**
* {@inheritdoc}
*/
public function getExportProperties() {
$properties = parent::getExportProperties();
public function toArray() {
$properties = parent::toArray();
// @todo Make $description protected and include it here, see
// https://drupal.org/node/2030645.
$names = array(
......
......@@ -120,10 +120,10 @@ public function getTips() {
}
/**
* Overrides \Drupal\Core\Config\Entity\ConfigEntityBase::getExportProperties();
* {@inheritdoc}
*/
public function getExportProperties() {
$properties = parent::getExportProperties();
public function toArray() {
$properties = parent::toArray();
$names = array(
'routes',
'tips',
......
......@@ -242,9 +242,9 @@ public function &getDisplay($display_id) {
}
/**
* Overrides \Drupal\Core\Config\Entity\ConfigEntityBase::getExportProperties();
* {@inheritdoc}
*/
public function getExportProperties() {
public function toArray() {
$names = array(
'base_field',
'base_table',
......
......@@ -910,10 +910,10 @@ public function enforceIsNew($value = TRUE) {
}
/**
* Implements \Drupal\Core\Entity\EntityInterface::getExportProperties().
* {@inheritdoc}
*/
public function getExportProperties() {
return $this->storage->getExportProperties();
public function toArray() {
return $this->storage->toArray();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment