Hello, fellow Neosians,
as we are currently implementing a PIM based on the regular Neos UI, we’re considering a few additions to the CR that have been on my mind for some time now anyway.
The Concept
The challenge is to make the attribute schema of a product editable, both which attributes exist and what values they can have but without falling into the same traps that other systems did and model everything as their regular entities, which would be nodes in our case.
I’ll use the GQL/Cypher syntax for this:
(node {properties})
-- [reference {properties}] ->
(node {properties})
My idea ist to use our property graph model as follows:
(product)
-- [value {?value: ..., ?valueReference: ...}] ->
(attribute {?options: [...]})
Let’s have a look at general attributes in order of complexity:
Scalar values
e.g. length: 3.14m
It does not make sense to manage attribute options here, but we need to make sure we get a certain type of relation: it must declare a float value. Scope of the value can be NodeAggregate.
(product)
-- [value:FloatQuantitativeValue {value: float}] ->
(length:Dimension {name: string, dimension: string, unit: string})
Product specific values in general
similar to scalar values, but with other types. Scope of the value can be anything, whatever makes sense.
Value lists
e.g. size (one of S,M,L). Managed as options on the attribute node. Translatable on the attribute node. Must be written to the reference as a valueReference, meaning it must have an id for referencing:
StringOption: {id: string, value: string}
(product)
-- [value {valueReference: optionId}] ->
(size:StringOptionProvider {name: string, options: StringOption[ ]})
Scope of the value can be NodeAggregate, scope of the option id must be NodeAggregate, scope of the option value can be anything.
Required extensions to Neos
References must be typed (similar to nodes) :
DistributionPackages/Acme.Catalog/ReferenceTypes/QuantitativeValue.yaml
Acme.Catalog:QuantitativeValue:
properties:
value:
type: float
minValue:
type: float
maxValue:
type: float
Untyped references must either be migrated or fall back to something similar to unstructured (there should not be too many references with properties around yet)
Nodes must be able to limit how they can be referenced
'Acme.Catalog:Content.DimensionAttribute':
[...]
constraints:
referenceTypes:
'*': false
'Acme.Catalog:QuantitativeValue': true
Nodes must be able to declare the type of references to be used:
'Acme.Catalog:Document.Product'
references:
attributes:
constraints:
referenceTypes:
'*': false
'Acme.Catalog:QuantitativeValue': true
'Acme.Catalog:SimpleValue': true
We need the reference editor for this: WIP: FEATURE: New reference editor (DD Sprint) by mhsdesign · Pull Request #4021 · neos/neos-ui · GitHub
The reference editor must respect the reference constraints of the target node (similar to how the creation thingy respects the child constraints).
The reference editor must be able to evaluate the target node: If the target attribute has options S,M,L, those must be selectable by ID in a selectbox editor (could be UI configuration)
Target Version
As this should be implementable in a non-breaking way, target version would be 9.3
WDYT?