Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hei,
i love the idea and opportunities this module provides. Sadly it's not possible to use it for me.
After enabling the module our local site runs in a timeout (30s) and the memory consumption goes very high so that it goes over 128mb of memory usage.
The site makes heavy use of paragraphs, perhaps this is the problem?
What informations should i provide so that we can debug this issue?
Thanks in advance
Comments
Comment #2
shadcn CreditAttribution: shadcn at Chapter Three commentedHi. So this happens when there’s a circular entity reference. Entity A references entity B and B references A.
We have a fix for this. I haven’t had time to look at it. I’ll see if I can commit it later today
Comment #3
yobottehg CreditAttribution: yobottehg commentedThis could definitely be the problem.
The frontpage has a teaser section for products. Products have a lot of entity reference revision fields which reference a lot of other things. Somewhere inside there will be some loop.
Comment #4
shadcn CreditAttribution: shadcn at Chapter Three commentedAgreed. This is why we are now making entity reference normalization opt-in. We should have a fix up on the site soon.
(Bumping this to major)
Comment #5
yobottehg CreditAttribution: yobottehg commentedSomething like a |serialize twig filter could work. Or something like the jsonapi_defaults module in which you can specify per resource / content type which things to serialise / include by default.
Comment #6
shadcn CreditAttribution: shadcn at Chapter Three commentedOK I finally got some time today to work on this.
The
EntityReferenceFieldItemNormalizer
now returns simple values fortarget_id, target_type..etc
which you can now feed to a Twigvalue()
function to get field values back.Example: (assumes an article node type referencing an author entity type).
Before (8.x-1.x)
After (8.x-2.x)
Can you test and let me know what you think? (Note this is in the 8.x-2.x branch)
Thanks
Comment #7
yobottehg CreditAttribution: yobottehg commentedThanks, I'll test this on a project i'm working on and let you know the next days.
Comment #8
yobottehg CreditAttribution: yobottehg commentedSo i tested this and it's working!
I got no more out of memory issues and the overall performance is really good.
I have some suggestions and also some patches that i'll upload in different issues.
First:
Currently the value function will always load the original language of the entity and not the translation if there is one.
-> I added the entity repository service and load the translation if it exists. Will provide a patch.
Second:
The entity reference normaliser will also only normalise the values of the original entity and not the translation if there is one.
-> Same as on First
Third:
The DX in handling the multiple entity references is currently suboptimal.
Example here:
-> I added a value_multiple twig function for this use cases.
I will create the follow ups now.
Comment #9
yobottehg CreditAttribution: yobottehg commentedComment #10
shadcn CreditAttribution: shadcn at Chapter Three commented@yobottehg Thanks for testing. This is now in the 8.x-2.x branch. We can follow up in the related issues. Really appreciate the help.