Add missing DocumentElementType Renderlet#1005
Conversation
|
|
Adds a RenderletType GraphQL type and its query field config generator, modeled on the existing RelationsType, exposing the editable's _editableType/_editableName/id/type/subtype and its single relation target. Registers the generator service and baselines the new static() usage. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Extract a resolveRenderlet() helper for the simple editable fields so the repeated instanceof checks no longer live inside getInstance(), reducing its cognitive complexity below the threshold. Drop the unused resolver parameters from those fields and wrap the relation resolver signature to stay within the line-length limit. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@kingjia90 Can you review this also please? |
There was a problem hiding this comment.
Pull request overview
This PR adds GraphQL query support for the Pimcore "Renderlet" document editable, which was previously the only document element type missing a GraphQL type. It introduces a new RenderletType (exposing _editableType, _editableName, id, type, subtype, and the referenced relation resolved as an anytarget element), a matching Renderlet field-config generator, and wires them up via service configuration. The remainder of the diff is a regenerated studio frontend build (new hash directory 64084715… replacing 785fd5b2…).
Changes:
- New
RenderletTypeGraphQL object type, mirroring the existingRelationType(usesgetO()for the relation target instead ofgetElement()). - New
Renderletquery field config generator + service registration ingraphql.yml, and a phpstan-baseline entry for thenew static()usage. - Regenerated studio build artifacts and a refreshed
manifest/publicPathhash.
Reviewed changes
Copilot reviewed 12 out of 27 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/GraphQL/DocumentElementType/RenderletType.php | New GraphQL type exposing Renderlet fields and relation |
| src/GraphQL/DocumentElementQueryFieldConfigGenerator/Renderlet.php | New generator returning RenderletType, consistent with siblings |
| src/Resources/config/graphql.yml | Registers the Renderlet type generator service |
| phpstan-baseline.neon | Baselines the new static() warning for RenderletType |
| src/Resources/public/studio/build/64084715.../* | Regenerated studio frontend build artifacts (new hash dir) |
| src/Resources/public/studio/build/785fd5b2.../* | Removed previous studio build artifacts |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@kingjia90 Every time I work with the DataHub GraphQL API, I find errors. It’s happened again today #1115. It seems I’m the only one submitting bug fixes. But these have been left unresolved since November. I wonder if we’re the only ones using this API... |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 27 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
src/Resources/public/studio/build/64084715-c37d-4575-98f2-2172027a803c/mf-stats.json:25
- This PR bundles a complete Studio frontend rebuild — the entire build output directory is regenerated under a new hash (
64084715-c37d-4575-98f2-2172027a803c) and the previous one (785fd5b2-5311-4070-9fc4-81949c904ac6) is removed, including thousands of lines of regenerated/minified JS. The PR description only covers the backend GraphQL Renderlet document editable (PHP type, config generator, service registration, phpstan baseline). There is no frontend source change in this PR that requires this rebuild, and the Renderlet GraphQL type does not depend on the Studio bundle. Please confirm whether this frontend rebuild is intentional; if not, consider splitting it out so the backend change can be reviewed and reverted independently of the generated assets.
|
Solid structure (mirrors
|
Address code review feedback on the new Renderlet document element type: - relation: call load() before getO(). getO() does not lazy-load and $o is stripped from the serialized document in the core cache, so cache-hit documents resolved relation to null despite a valid target. - relation: filter unpublished targets, mirroring Relation::getElement(). getO() does no publish check and nothing downstream compensated. - type: expose the target's real element type via getData()['type'] instead of Renderlet::getType(), which is hardcoded to 'renderlet' and duplicated _editableType. - doc: add Renderlet to the supported page element types list. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Fixed in 980e713.
|
Both lines exceeded the 120-character limit. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|







Adds GraphQL support for the Renderlet document editable, which was previously missing from the document element types.
Introduces a new RenderletType exposing the editable's _editableType, _editableName, id, type, subtype and the referenced relation (resolved as an anytarget element), plus the corresponding Renderlet query field config generator and its service registration.