Per https://github.com/symfony/symfony/issues/3251 the attributes can only be a one dimensional array. That PHP does not throw an error on them is a bug https://github.com/symfony/symfony/issues/7543 (igorw told me to file that as a bug).

The serialization bundle uses a multidimensional array, for now in #1939660-31: Use YAML as the primary means for service registration i have cut it back to a) only support one format per registration b) use format => xml and then we can do more / better here. igorw suggested container parameters to do the tunes of serializer.encoder.xml => XML.

CommentFileSizeAuthor
#3 1958484-do-not-test.patch13.59 KBchx
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

chx’s picture

Assigned: Unassigned » klausi
chx’s picture

Title: Serialization uses addTag incorrectly » Serialization classes are not plugins
Priority: Normal » Major

Why are these not plugins in the first place?

chx’s picture

Title: Serialization classes are not plugins » Serialization uses addTag incorrectly
Priority: Major » Normal
FileSize
13.59 KB

OK, so I hear they don't want to be plugins.

For easier review, here's the patch for the jsonld,hal and serialization dirs from the YAML service issue.

Anonymous’s picture

To unblock chx's patch, I'd say we can go ahead with this.

However, it introduces the possibility of a hard-to-debug issue in some cases (described below). We should fix this in this issue once chx's patch is in.

Lets say that JsonLdEncoder supports both jsonld and drupal_jsonld. With the new approach, two services would be registered for the Encoder, encoder.jsonld and encoder.drupal_jsonld. These would both be added to the chain of encoders, for example

JsonLdEncoder - JsonLdEncoder - XmlEncoder - JsonEncoder

If a developer comes along and decides they want to change which Encoder responds to drupal_jsonld requests, they would switch out the service named encoder.drupal_jsonld. This could result in the following chain.

JsonLdEncoder - CustomDrupalJsonLdEncoder - XmlEncoder - JsonEncoder

In this case, since JsonLdEncoder::supportsEncoding returns TRUE for both jsonld and drupal_jsonld, the developer's custom encoder would never be reached. This seems like a developer WTF to me.

damiankloip’s picture

Status: Active » Fixed

This has already happened, was committed from the issue chx was referring to in#3

chx’s picture

Status: Fixed » Active

Well it happened but I have dumbed it down to make it happen and this issue is whether it needs to be smartened up somehow again :)

damiankloip’s picture

OK, fair enough. Let's talk :)

damiankloip’s picture

Issue summary: View changes
Status: Active » Fixed

I don't think this needs to be smartened up. The YAML conversion was good I think. chx if you read this, and think it should still be open, please re open. thanks!

Status: Fixed » Closed (fixed)

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