Closed (fixed)
Project:
Tome
Version:
8.x-1.x-dev
Component:
Tome Sync
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
20 Jun 2018 at 22:28 UTC
Updated:
19 Mar 2022 at 01:59 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
samuel.mortenson@betz There wasn't really - I just wasn't sure if core's normalization supported YAML as a format. If it does I'd be happy to review a patch.
Comment #3
samuel.mortensonI just looked into this, it looks like there is no Symphony serializer support for YML, so I don't think I'm going to support it in Tome. Core's test coverage for entity serialization also uses JSON (and XML, and HAL-JSON), so I don't want to go into uncharted territory with using YML.
The good news is that contrib, or a sub-module of Tome, could override the
tome.storage.contentservice (using service decorators, I think?) to use any format they want (including remote storage!), so there are options going forward.I'm going to close this issue, but if you can come up with a patch that adds a sub-module that uses YML I'll look into adding it. For now I'm sticking with JSON going forward. Thanks!
Comment #4
samuel.mortensonThis is possible now
Comment #5
samuel.mortensonComment #6
samuel.mortensonHere's a start to this, which appears to work. Core doesn't have an encoder for Yaml yet which is what I thought originally, but it turns out making out own makes sense for controlling the output.
Comment #7
samuel.mortensonAdded importer tests as well.
Comment #8
larowlanshould you assert something about the contents of the file too?
Looks good, but from memory we didn't use YAML as an export format in core for security reasons.
Comment #9
samuel.mortenson@larowlan YAML is scarier but AFAIK Symfony's encoder with the flags I'm using should be fine, no object or constant parsing, but I'll double check that.
For the test coverage - this is mimicking the JSON test coverage in the same file, basically the fact that the file storage works and the entity is denormalized is good enough for me. However I am doing some tricky (and likely stupid) things with the YAML so I could check that mullti-line strings work.
Comment #10
samuel.mortensonAlso just saw that https://www.drupal.org/project/default_content uses Yaml as of 2.0 - our modules have a lot of overlap lol!
Comment #11
bserem commentedI tested the patch and things were smooth, I have to admit though that I tested with demo content on a site still under development.
As for default_content it does use YAML, but it has a different scope (to provide default content, not to import/export content).
tome_sync has an overlapping scope with default_content_deploy, but I find tome more straightforward :)
Comment #12
mxr576But this is an actively maintained solution ;)
Comment #14
samuel.mortensonThanks all, let's ship it! I'll do a release this month.