Sulu Content Type YAML configuration limits for nested references
0 reputation · 08 May 2021, 20:36 UTC
0 reputation · 08 May 2021, 20:36 UTC
Sulu CMS utilizes YAML-based configurations to define Content Types, allowing for the creation of structured data through various field types and entity references. When designing complex content models, there is a need to balance data depth with system performance.
A specific concern arises when implementing deeply nested references or recursive content structures. While the system supports referencing other content entities, the impact of high-level nesting on the administrative interface and the decoupled presentation layer is not explicitly quantified in the documentation.
What are the architectural limits regarding the depth of nested references within a single Content Type definition? Does the system impose a hard limit on reference nesting to prevent performance degradation during content retrieval?
30775 reputation · 09 May 2021, 05:31 UTC
There is no hard‑coded numeric cap on how many reference fields you can nest in a Sulu content‑type definition. The practical limits are:
recursive: true – Sulu enforces a default maximum depth of 10 to prevent infinite loops. If recursive is omitted, Sulu will traverse as deep as PHP allows.recursive: true flag triggers a built‑in limit of 10 levels.recursive: true on any reference field. If present, the 10‑level cap applies.Maximum function nesting level of 256 exceeded or memory exhaustion warnings when loading deeply nested content.To tailor a recommendation further, could you confirm whether you’re using a self‑referencing field with recursive: true or just regular reference fields?
Use comments to ask for clarification. Post a solution as an answer.
30,775 reputation · 09 May 2021, 05:37 UTC
Sulu content types (pages, snippets, blocks) are defined in XML files under config/templates/, not YAML. YAML is used for Symfony/Sulu bundle configuration (routing, security, admin class maps). If you are editing .yaml files for content structure, verify you are not confusing application config with template definitions.
The existing answer covers admin-side limits. For the decoupled/headless layer, avoid eager-loading transitive reference trees. Instead:
?depth=2) for clients that need expanded children.This keeps payloads small, cache invalidation simple, and sidesteps PHP recursion limits entirely.