diff --git a/core/modules/config/lib/Drupal/config/ConfigStorageController.php b/core/modules/config/lib/Drupal/config/ConfigStorageController.php index 57c2583..dcb7717 100644 --- a/core/modules/config/lib/Drupal/config/ConfigStorageController.php +++ b/core/modules/config/lib/Drupal/config/ConfigStorageController.php @@ -271,7 +271,8 @@ public function save(StorableInterface $entity) { // Configuration objects do not have a schema. Extract all key names from // class properties. $class_info = new \ReflectionClass($entity); - foreach ($class_info->getProperties(\ReflectionProperty::IS_PUBLIC) as $property) { + $properties = $class_info->getProperties(\ReflectionProperty::IS_PUBLIC); + foreach ($properties as $property) { $name = $property->getName(); $config->set($name, $entity->$name); } diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigImportTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigImportTest.php index 48ef435..09572df 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigImportTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigImportTest.php @@ -97,6 +97,9 @@ function testDeleted() { $this->assertFalse(isset($GLOBALS['hook_config_test']['update'])); $this->assertTrue(isset($GLOBALS['hook_config_test']['predelete'])); $this->assertTrue(isset($GLOBALS['hook_config_test']['delete'])); + + // Verify that there is nothing more to import. + $this->assertFalse(config_sync_get_changes($state, $storage)); } /** @@ -126,6 +129,9 @@ function testNew() { $original_dynamic_data = array( 'id' => 'new', 'label' => 'New', + 'langcode' => 'und', + 'style' => '', + 'uuid' => '30df59bd-7b03-4cf7-bb35-d42fc49f0651', ); $state->write($dynamic_name, $original_dynamic_data); $this->assertIdentical($state->exists($name), TRUE, $name . ' found.'); @@ -147,6 +153,9 @@ function testNew() { $this->assertFalse(isset($GLOBALS['hook_config_test']['update'])); $this->assertFalse(isset($GLOBALS['hook_config_test']['predelete'])); $this->assertFalse(isset($GLOBALS['hook_config_test']['delete'])); + + // Verify that there is nothing more to import. + $this->assertFalse(config_sync_get_changes($state, $storage)); } /** @@ -173,10 +182,8 @@ function testUpdated() { 'foo' => 'beer', ); $state->write($name, $original_name_data); - $original_dynamic_data = array( - 'id' => 'default', - 'label' => 'Updated', - ); + $original_dynamic_data = $state->read($dynamic_name); + $original_dynamic_data['label'] = 'Updated'; $state->write($dynamic_name, $original_dynamic_data); // Verify the active store still returns the default values. @@ -205,6 +212,9 @@ function testUpdated() { $this->assertTrue(isset($GLOBALS['hook_config_test']['update'])); $this->assertFalse(isset($GLOBALS['hook_config_test']['predelete'])); $this->assertFalse(isset($GLOBALS['hook_config_test']['delete'])); + + // Verify that there is nothing more to import. + $this->assertFalse(config_sync_get_changes($state, $storage)); } } diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigImportUITest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigImportUITest.php index de0ccb2..ea20651 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigImportUITest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigImportUITest.php @@ -95,6 +95,9 @@ function testImport() { $original_dynamic_data = array( 'id' => 'new', 'label' => 'New', + 'langcode' => 'und', + 'style' => '', + 'uuid' => '30df59bd-7b03-4cf7-bb35-d42fc49f0651', ); $state->write($dynamic_name, $original_dynamic_data); $this->assertIdentical($state->exists($name), TRUE, $name . ' found.'); diff --git a/core/modules/entity/lib/Drupal/entity/StorableBase.php b/core/modules/entity/lib/Drupal/entity/StorableBase.php index 57bf352..c5d9867 100644 --- a/core/modules/entity/lib/Drupal/entity/StorableBase.php +++ b/core/modules/entity/lib/Drupal/entity/StorableBase.php @@ -45,7 +45,7 @@ * * @var bool */ - public $isCurrentRevision = TRUE; + protected $isCurrentRevision = TRUE; /** * Constructs a new entity object. @@ -280,7 +280,11 @@ public function getRevisionId() { /** * Implements Drupal\entity\StorableInterface::isCurrentRevision(). */ - public function isCurrentRevision() { - return $this->isCurrentRevision; + public function isCurrentRevision($new_value = NULL) { + $return = $this->isCurrentRevision; + if (isset($new_value)) { + $this->isCurrentRevision = (bool) $new_value; + } + return $return; } } diff --git a/core/modules/entity/lib/Drupal/entity/StorableInterface.php b/core/modules/entity/lib/Drupal/entity/StorableInterface.php index 23bc1ea..b784260 100644 --- a/core/modules/entity/lib/Drupal/entity/StorableInterface.php +++ b/core/modules/entity/lib/Drupal/entity/StorableInterface.php @@ -211,8 +211,13 @@ public function getRevisionId(); /** * Checks if this entity is the current revision. * + * @param bool $new_value + * (optional) A Boolean to (re)set the isCurrentRevision flag. + * * @return bool - * TRUE if the entity is the current revision, FALSE otherwise. + * TRUE if the entity is the current revision, FALSE otherwise. If + * $new_value was passed, the previous value is returned. */ - public function isCurrentRevision(); + public function isCurrentRevision($new_value = NULL); + }