FYI, I created a sandbox called 'Better Normalizers ', https://www.drupal.org/sandbox/sam/2705067. The intention being, sharing this code between modules. Maybe copying them is easiest if they are likely to vary between these modules anyway, but it was required for aGov because we needed the file_entity normalizers but didn't want a dependency on file_entity itself.
git fetch-patch https://www.drupal.org/files/issues/2687075-14.patch
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 4581 100 4581 0 0 3990 0 0:00:01 0:00:01 --:--:-- 3993
error: src/DefaultContentServiceProvider.php: No such file or directory
error: src/Tests/DefaultContentManagerIntegrationTest.php: No such file or directory
Comments
Comment #2
gaydabura commentedTemporary solution.
Also we remove term itself from "parent" to prevent recursion
Comment #3
gaydabura commentedComment #4
andypostPlease describe steps to reproduce to write tests
that needs inline comment Why
Comment #5
gaydabura commentedTo reproduce:
1. Create vocabulary
2. Add terms with hierarchy
3. Export terms
4. Try to import terms
No hierarchy.
Comment #7
gaydabura commented+ unset($parents[$entity->id()]);This needed to avoid recursion when term depends on itself. For some reason loadAllParents add term itself to tree.
Comment #8
gaydabura commentedComment #9
larowlanThis is the wrong fix - we need a new normalizer like EntityPilot has - see http://cgit.drupalcode.org/entity_pilot/tree/src/Normalizer/TermEntityNo... and http://cgit.drupalcode.org/entity_pilot/tree/src/EntityPilotServiceProvi...
Comment #10
larowlanComment #11
andypostHere it is, still needs tests
Comment #12
jibranGiven that this is the same normalizer we have in entity pilot. I think we should add this normalizer to core.
Comment #13
andyposttrying to write tests
no need for core, just need to fix #2543726: Make $term->parent behave like any other entity reference field, to fix REST and Migrate support and de-customize its Views integration
Comment #14
jibranThis is an alter function so we should move this service definition to yml file. Do we really need module exist check for taxonomy?
Comment #15
andypostHere's a test
Comment #17
andypost@jibran suppose we have to check for module enable, otherwise default content module should set dependency
Comment #18
jibranOk that's fine so why not use
DefaultContentServiceProvider::register()instead.Comment #19
andypostpersonally because there's alter already
Comment #20
sam152 commentedFYI, I created a sandbox called 'Better Normalizers ', https://www.drupal.org/sandbox/sam/2705067. The intention being, sharing this code between modules. Maybe copying them is easiest if they are likely to vary between these modules anyway, but it was required for aGov because we needed the file_entity normalizers but didn't want a dependency on file_entity itself.
Comment #21
sqndr commentedIs there a way to manually at the parent to the json file? I'm still not able to export the parent for taxonomy terms …
Comment #23
larowlanComment #24
larowlanComment #25
aleevasRerolled last patch.
Comment #27
andypostthis part missed in reroll
Comment #28
andypostService provider gone, so patch restores
Tests needs review cos old ones are refactored
Comment #29
larowlanI think this is ready too, will commit on Monday if still RTBC
Comment #30
danepowell commentedPatch #28 worked for me. Thanks.
Comment #31
danepowell commentedNote that I just filed #2796791: Recursive reference export, which might be a problem specific to this patch or something more general.
Comment #32
hydra commented#28 Still working for me :) THx!
Comment #34
larowlanFixed, thanks!
Comment #36
jibran