Drupal 7 EntityReferenceRecursiveRenderingException Error
So I ran into a new and interesting error today:
Never having seen this error before, I was rather perplexed. What the heck was this? A search didn't turn up anything particular useful, until I went much further down the list and noticed some one talking about entity reference.
The error above is achevied by having a content type with an entity reference field. That field is then set to display "full content" on output for the referenced entities. From there, let's say Node A, references Node B, and both are the same content type. For this error to occur, Node B must also reference node A (or some other longer path of referencing nodes that reaches from A to C, then back to A again for example). What happens is the display for this content type lodas the first node, and then loads the full nodes for all node references. Node A is first loaded, and loads referenced node B. Node B references node A, so node A is loaded yet again... which references and loads Node B... and onward until memory fills up, or Drupal catches the error and triggers the recursive rendering exception and outputs: EntityReferenceRecursiveRenderingException
- Don't render the full node for the display output. There is no reason I can conceive of for a full node to render another full node that can possibly render itself. USE TEASER, or better yet add another display variation. That teaser or alternative display will need to
- There's a patch linked in the below stack exchange that limits recurrsion. It's a bandaid on a bullet wound and using this is serious admission to having done something very wrong and glossing over it.
Good luck everyone!