Problem/Motivation
I can't import content with ERRItems via default content. I get the following exception.
exception 'InvalidArgumentException' with message 'Value is not a valid entity.' in modules/contrib/entity_reference_revisions/src/Plugin/DataType/EntityReferenceRevisions.php
Proposed resolution
I think we have to implement a specific normalization for the ERRItem which handles the additional target_revision_id property.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #32 | 2598138-hal.35.patch | 7.7 KB | larowlan |
| #32 | interdiff.txt | 3.07 KB | larowlan |
| #30 | 2598138-hal.24.patch | 9.47 KB | larowlan |
Comments
Comment #2
webflo commentedThe patch should fails because of the unmet dependency to rest and serialization module.
Comment #4
webflo commentedComment #5
zach.bimson commented+1 On this...
Have applied the patch, am looking into fixing this also.
Comment #6
zach.bimson commentedSmall patch, not sure if its the best approach and i still need to test more but seems to work after preliminary testing...
Comment #7
zach.bimson commentedPatch off rc4
Comment #8
miro_dietikerLet's see what testbot thinks. Patches please always against latest dev.
Comment #11
larowlanInstead of doing this, we should use a ServiceProvider that only adds the normalizer if these modules are enabled, e.g. see FileEntityServiceProvider in file_entity module
Comment #12
larowlanThis will also fix support for paragraphs in Entity Pilot #2696447: Paragraph module integration and default_content module
Will try and push this along sometime this week
Comment #13
zach.bimson commentedI've created a new patch adding a service provider but i still wasn't able to drop the hal/ serialization dependencies...
Am i missing something ?
The export is also broken but im going to take a look into that when i can
Comment #14
zach.bimson commentedI did select, test against dev but its not worked again...
Comment #16
larowlanSo both of these can go
We should check if hal exists in $modules, if so, then we alter the container, if not we don't
This should match what is in services.yml, so priority should be 11.
there are some white space issues here
Comment #17
zach.bimson commented1. Care to explain why? your comment is anything but helpful. (If these dependencies aren't there it fails)
2. Without HAL the installed this fails anyway, will re instate the if.
3. It was set to 11 but i made it higher while we are still debugging
Comment #18
larowlanSorry, I didn't mean to be rude, I'll update the patch.
Comment #19
larowlanPatch attached.
What I was trying to say in point 1 is that if you use a ServiceProvider, then you don't need a services.yml file.
And then you don't need the dependency - see the interdiff.
Comment #21
larowlanWorking on fails
Comment #22
zach.bimson commentedNo problem, id been working on a patch and was about to submit it just as you commented! nice work! The dependencies are met if the module is installed on an active site but in my case this module is enabled by paragraphs which is inturn enabled by our custom default content module that is enabled when installing our profile... Even though our default content module relies on hal and serialization... Adding those back to the info file fixes the build... Any ideas ?
Comment #23
larowlanThis should sort default_content, not sure about your profile - note that the order you define stuff in your .info.yml file is significant from memory
Fixes failing test and adds a test for the new functionality.
Comment #25
larowlanmeh
Comment #26
zach.bimson commentedThis patch isnt going to be what you're looking for but ive made a couple of changes that work for me... Have uploaded and will use this in my make file till this is totally fixed.
Comment #28
dmouse@zach.bimson can You post the innerdiff? Or, what are your changes?
Comment #29
larowlanHere is @zach.bimson's interdiff
Comment #30
larowlanHere is the same patch as #25 which is the one to be reviewed
Comment #31
berdirJust some nitpicks, looks good to me otherwise.
@file isn't needed anymore.
That reads like it was copied from file_entity.
You probably want to refer to serializer.normalizer.entity_reference_item.hal instead?
unrelated changes?
also an unrelated fix.
Seems like the test could be a kernel test and would be a lot faster then but would also be a lot of work to change that now.
Comment #32
larowlanRe-roll and fixes #31
Comment #34
miro_dietikerGreat thx, committed.
Comment #35
arla commentedI think this doesn't work well with default_content. When the referenced content is imported it gets a new sequential revision_id, so target_revision_id in the referencing field is wrong.
Comment #36
berdirI think there is a way to save an entity with a specific revision ID, migrate does that AFAIK too. Maybe we can change default_content to ensure that.