ConfigStorageController::save() currently assumes that only and all public properties are to be written to storage.

This gives no opportunity to remove public properties from the export, or more importantly, to add in protected properties via a getter method.

CommentFileSizeAuthor
#1 drupal-1824484-1.patch1.97 KBtim.plunkett
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tim.plunkett’s picture

Status: Active » Needs review
FileSize
1.97 KB

This just moves the current code out of the middle of save() and into it's own method.

dawehner’s picture

+++ b/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.phpundefined
@@ -310,6 +306,29 @@ public function save(EntityInterface $entity) {
+   * @param \Drupal\Core\Entity\EntityInterface $entity
+   *   The entity being saved.
...
+  protected function getProperties(EntityInterface $entity) {

Couldn't we use ConfigEntityInterface here, as the config storage controller will also just care about that.

tim.plunkett’s picture

We use EntityInterface for everything else, and it would just mean another class to use when overriding it.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

So we could do that globally later as a follow up.
The rest is just pure c&p and used by all tests already.

damiankloip’s picture

Yep, agreed.

tim.plunkett’s picture

Category: feature » task

This isn't really a "feature request", but an necessary API improvement. We just discussed at the sprint and this is definitely a task.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.x. Thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.