Updated: Comment #N

Problem/Motivation

We can normalize/denormalize content entities, why not config entities too? They are a massive part of Drupal 8 architecture. It seems very reasonable people will want to serialize/unserialize this stuff with the serializer in web services. For such a small patch, it seems better to provide this in core, rather than have x contrib modules providing a similar thing all over the place.

Proposed resolution

Extend the EntityNormalizer class and override the normalize() method to call getExportProperties() - DONE.

Remaining tasks

Patch, review.

User interface changes

None

API changes

None

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

damiankloip’s picture

Title: Provide an ConfigEntityNormalizer » Provide a ConfigEntityNormalizer

Hmm, poor english there..

aspilicious’s picture

I agree this should be part of core

dawehner’s picture

  1. +++ b/core/modules/serialization/tests/Drupal/serialization/Tests/Normalizer/ConfigNormalizerTest.php
    @@ -0,0 +1,48 @@
    + * @see \Drupal\serialization\Normalizer\ConfigEntityNormalizer
    + */
    +class ConfigEntityNormalizerTest extends UnitTestCase {
    

    see the other issue ...

  2. +++ b/core/modules/serialization/tests/Drupal/serialization/Tests/Normalizer/ConfigNormalizerTest.php
    @@ -0,0 +1,48 @@
    +  public static function getInfo() {
    

    inheritdoc

  3. +++ b/core/modules/serialization/tests/Drupal/serialization/Tests/Normalizer/ConfigNormalizerTest.php
    @@ -0,0 +1,48 @@
    +    $this->assertsame($test_export_properties, $normalizer->normalize($config_entity));
    

    assertsame => assertSame

damiankloip’s picture

FileSize
3.41 KB
1.38 KB

Thanks for the review!

Status: Needs review » Needs work

The last submitted patch, 4: 2191903-4.patch, failed testing.

damiankloip’s picture

4: 2191903-4.patch queued for re-testing.

damiankloip’s picture

Status: Needs work » Needs review
dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Thank you for fixing the points.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Fancy.

Committed/pushed to 8.x, thanks!

Status: Fixed » Closed (fixed)

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