Last modified: 2013-11-12 16:31:14 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T51952, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 49952 - SerializerFactory needs to be re-designed
SerializerFactory needs to be re-designed
Status: VERIFIED FIXED
Product: MediaWiki extensions
Classification: Unclassified
WikidataRepo (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Wikidata bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-21 09:54 UTC by Daniel Kinzler
Modified: 2013-11-12 16:31 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Daniel Kinzler 2013-06-21 09:54:34 UTC
The SerializerFactory needs a redesign. As it is now, (some of the) serializers require specialized option objects, so the caller has to know about them in advance, which defies the purpose of the factory.

Serialization needs to be able to work recursively, so I'd suggest to use the approach we discussed for serializers during the Q/A workshop:

Have a top level serialization service that knows serialization handlers for several kinds of objects. The serialization handlers get the serialization service passed into their serialize() method along with the object to serialize, so they can use the serialization service to opaquely serialize any sub-structures:

SerializationService {
   function __construct( Serializer[] );
   function serialize( object $object );
}

Serializer {
   function serialize( object $object, SerializationService $service );
}

Note that the name "serializer" should be reconsidered - our current serializers do not serialize, but convert to native data structures (nested arrays) which are later encoded as JSON (which is the actual serialization).

Perhaps the above could be renamed/generalized into ConverterService + Conversion, with the same basic interfaces (and perhaps even code) used to convert to and from native representation, generate HTML, etc.
Comment 1 Gerrit Notification Bot 2013-10-29 16:48:11 UTC
Change 89850 had a related patch set uploaded by Daniel Kinzler:
Consolidate SerializationOptions.

https://gerrit.wikimedia.org/r/89850
Comment 2 Gerrit Notification Bot 2013-10-31 09:27:11 UTC
Change 89850 merged by jenkins-bot:
[bug 49952] Consolidate SerializationOptions.

https://gerrit.wikimedia.org/r/89850
Comment 3 Lydia Pintscher 2013-11-05 13:55:12 UTC
patch is merged

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links