Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
graphql_core_schema
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
graphql_core_schema
Merge requests
!18
Add workaround support for dynamic_entity_reference fields
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Add workaround support for dynamic_entity_reference fields
3441330-workaround-support-for-dyanmic_entity_reference
into
1.0.x
Overview
0
Commits
1
Pipelines
2
Changes
1
Merged
Jan Hug
requested to merge
3441330-workaround-support-for-dyanmic_entity_reference
into
1.0.x
8 months ago
Overview
0
Commits
1
Pipelines
2
Changes
1
Expand
Closes
#3441330
0
0
Merge request reports
Compare
1.0.x
1.0.x (base)
and
latest version
latest version
27af8a00
1 commit,
8 months ago
1 file
+
15
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
src/EntitySchemaBuilder.php
+
15
−
0
Options
@@ -277,6 +277,9 @@ class EntitySchemaBuilder {
// this field at all.
return
NULL
;
}
elseif
(
$fieldType
===
'dynamic_entity_reference'
)
{
return
$field
->
type
(
'Entity'
);
}
elseif
(
$typedData
instanceof
TextWithSummaryItem
)
{
$summary
=
$this
->
createField
(
'summary'
)
->
type
(
'Boolean'
);
return
$field
->
type
(
'String'
)
->
argument
(
$summary
);
@@ -312,6 +315,15 @@ class EntitySchemaBuilder {
*/
private
function
getTypeForEntityReferenceFieldItem
(
FieldItemDataDefinitionInterface
$itemDefinition
):
?string
{
$targetType
=
$itemDefinition
->
getSetting
(
'target_type'
);
$dataType
=
$itemDefinition
->
getDataType
();
// Special handling for the "dynamic_entity_reference" contrib module that
// allows referencing multiple different entity types in a field.
// Because we don't (yet) support union types, we just type these fields
// using the generic Entity interface.
if
(
$dataType
===
'field_item:dynamic_entity_reference'
)
{
return
'Entity'
;
}
// Check if the target entity type is enabled.
if
(
!
$targetType
||
!
$this
->
config
->
isEntityTypeEnabled
(
$targetType
))
{
@@ -868,6 +880,9 @@ class EntitySchemaBuilder {
case
'config_dependencies'
:
return
'MapData'
;
case
'dynamic_entity_reference'
:
return
'Entity'
;
case
'_core_config_info'
:
return
NULL
;
Loading