-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from Flowpack/bugfix/61-triggerPropertyMapping
BUGFIX: Use property mapping for `type: SomeClass` or `array<SomeClass>`
- Loading branch information
Showing
14 changed files
with
276 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
Configuration/Testing/NodeTypes.ResolvablePropertyValues.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Test, that asset ids are correctly resolved to asset objects (via the property mapper) | ||
# Also reference node id's should be correctly resolved | ||
--- | ||
|
||
'Flowpack.NodeTemplates:Content.ResolvablePropertyValues': | ||
superTypes: | ||
'Neos.Neos:Content': true | ||
properties: | ||
asset: | ||
type: Neos\Media\Domain\Model\Asset | ||
images: | ||
type: array<Neos\Media\Domain\Model\ImageInterface> | ||
reference: | ||
type: reference | ||
references: | ||
type: references | ||
options: | ||
template: | ||
properties: | ||
asset: 'c228200e-7472-4290-9936-4454a5b5692a' | ||
reference: 'some-node-id' | ||
references: "${['some-node-id', 'other-node-id', data.realNode]}" | ||
images: "${['c8ae9f9f-dd11-4373-bf42-4bf31ec5bd19']}" |
27 changes: 27 additions & 0 deletions
27
Configuration/Testing/NodeTypes.UnresolvablePropertyValues.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# We make sure that we dont trigger unwanted property mapping, so we wont allow an array in a string field. | ||
--- | ||
|
||
'Flowpack.NodeTemplates:Content.UnresolvablePropertyValues': | ||
superTypes: | ||
'Neos.Neos:Content': true | ||
ui: | ||
label: UnresolvablePropertyValues | ||
properties: | ||
someString: | ||
type: string | ||
asset: | ||
type: Neos\Media\Domain\Model\Asset | ||
images: | ||
type: array<Neos\Media\Domain\Model\ImageInterface> | ||
reference: | ||
type: reference | ||
references: | ||
type: references | ||
options: | ||
template: | ||
properties: | ||
someString: "${['foo']}" | ||
reference: true | ||
references: "${['some-non-existing-node-id']}" | ||
asset: "non-existing" | ||
images: "${['non-existing']}" |
26 changes: 26 additions & 0 deletions
26
Tests/Functional/Fixtures/ResolvablePropertyValues.nodes.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"properties": { | ||
"asset": "object(Neos\\Media\\Domain\\Model\\Asset, c228200e-7472-4290-9936-4454a5b5692a)", | ||
"images": [ | ||
"object(Neos\\Media\\Domain\\Model\\Image, c8ae9f9f-dd11-4373-bf42-4bf31ec5bd19)" | ||
] | ||
}, | ||
"references": { | ||
"reference": [ | ||
{ | ||
"node": "Node(some-node-id, unstructured)" | ||
} | ||
], | ||
"references": [ | ||
{ | ||
"node": "Node(some-node-id, unstructured)" | ||
}, | ||
{ | ||
"node": "Node(other-node-id, unstructured)" | ||
}, | ||
{ | ||
"node": "Node(real-node-id, unstructured)" | ||
} | ||
] | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
Tests/Functional/Fixtures/ResolvablePropertyValues.template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"properties": { | ||
"asset": "c228200e-7472-4290-9936-4454a5b5692a", | ||
"reference": "some-node-id", | ||
"references": [ | ||
"some-node-id", | ||
"other-node-id", | ||
"Node(real-node-id, unstructured)" | ||
], | ||
"images": [ | ||
"c8ae9f9f-dd11-4373-bf42-4bf31ec5bd19" | ||
] | ||
}, | ||
"childNodes": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
'{nodeTypeName}': | ||
options: | ||
template: | ||
properties: | ||
# asset -> object(Neos\Media\Domain\Model\Asset) | ||
# images -> array(Neos\Media\Domain\Model\Image) | ||
# reference -> Reference of NodeTypes (Neos.Neos:Document) with value Node(some-node-id) | ||
# references -> Nodes(some-node-id, other-node-id, real-node-id) |
26 changes: 26 additions & 0 deletions
26
Tests/Functional/Fixtures/UnresolvablePropertyValues.messages.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[ | ||
{ | ||
"message": "Template for \"UnresolvablePropertyValues\" only partially applied. Please check the newly created nodes beneath Node \/sites\/test-site\/homepage\/main\/new-node@live[Flowpack.NodeTemplates:Content.UnresolvablePropertyValues].", | ||
"severity": "ERROR" | ||
}, | ||
{ | ||
"message": "Property \"asset\" in NodeType \"Flowpack.NodeTemplates:Content.UnresolvablePropertyValues\" | FlowException(Object of type \"Neos\\Media\\Domain\\Model\\Asset\" with identity \"non-existing\" not found., 1686779371122)", | ||
"severity": "ERROR" | ||
}, | ||
{ | ||
"message": "Property \"images\" in NodeType \"Flowpack.NodeTemplates:Content.UnresolvablePropertyValues\" | FlowException(Could not convert target type \"array<Neos\\Media\\Domain\\Model\\ImageInterface>\", at property path \"0\": No converter found which can be used to convert from \"string\" to \"Neos\\Media\\Domain\\Model\\ImageInterface\"., 1297759968) | TypeConverterException(No converter found which can be used to convert from \"string\" to \"Neos\\Media\\Domain\\Model\\ImageInterface\"., 0)", | ||
"severity": "ERROR" | ||
}, | ||
{ | ||
"message": "Property \"someString\" in NodeType \"Flowpack.NodeTemplates:Content.UnresolvablePropertyValues\" | PropertyIgnoredException(Because value `[\"foo\"]` is not assignable to property type \"string\"., 1685958105644)", | ||
"severity": "ERROR" | ||
}, | ||
{ | ||
"message": "Reference \"reference\" in NodeType \"Flowpack.NodeTemplates:Content.UnresolvablePropertyValues\" | RuntimeException(Reference could not be set, because node reference(s) true cannot be resolved., 1685958176560)", | ||
"severity": "ERROR" | ||
}, | ||
{ | ||
"message": "Reference \"references\" in NodeType \"Flowpack.NodeTemplates:Content.UnresolvablePropertyValues\" | RuntimeException(Reference could not be set, because node reference(s) [\"some-non-existing-node-id\"] cannot be resolved., 1685958176560)", | ||
"severity": "ERROR" | ||
} | ||
] |
1 change: 1 addition & 0 deletions
1
Tests/Functional/Fixtures/UnresolvablePropertyValues.nodes.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[] |
16 changes: 16 additions & 0 deletions
16
Tests/Functional/Fixtures/UnresolvablePropertyValues.template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"properties": { | ||
"someString": [ | ||
"foo" | ||
], | ||
"reference": true, | ||
"references": [ | ||
"some-non-existing-node-id" | ||
], | ||
"asset": "non-existing", | ||
"images": [ | ||
"non-existing" | ||
] | ||
}, | ||
"childNodes": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
'{nodeTypeName}': | ||
options: | ||
template: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.