Skip to content

ES CR: Reference properties #3849

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Jul 25, 2022
Merged

ES CR: Reference properties #3849

merged 22 commits into from
Jul 25, 2022

Conversation

nezaniel
Copy link
Member

This introduces references as first class citizens:

  • Reference{PropertyName $name, PropertyCollection $properties, Node $node}
  • ContentSubgraphInterface::findReferencingNodes and findReferencedNodes now return References instead of Nodes
  • all entry points (FlowQuery, Change models,...) have been adjusted to extract the Nodes from the References for now

Checklist

  • [ X ] Code follows the PSR-12 coding style
  • [ X ] Tests have been created, run and adjusted as needed
  • [ X ] The PR is created against the lowest maintained branch
  • Reviewer - PR Title is brief but complete and starts with FEATURE|TASK|BUGFIX
  • Reviewer - The first section explains the change briefly for change-logs
  • Reviewer - Breaking Changes are marked with !!! and have upgrade-instructions

Copy link
Member

@skurfuerst skurfuerst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nezaniel I love this feature and the change :) I have some nitpick comments / questions, which we can as well discuss via a call next week.

All the best,
Sebastian

'name' => $event->referenceName,
'position' => $position,
'nodeanchorpoint' => $nodeAnchorPoint,
'destinationnodeaggregateidentifier' => $reference->targetNodeAggregateIdentifier,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we unify the naming here or is there a reason for 2 different names?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's unify it, should be consistent from command to read model imho

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, it's now source->target everywhere

@@ -27,30 +27,30 @@ final class NodeReferencesWereSet implements
public function __construct(
public readonly ContentStreamIdentifier $contentStreamIdentifier,
public readonly NodeAggregateIdentifier $sourceNodeAggregateIdentifier,
public readonly OriginDimensionSpacePoint $sourceOriginDimensionSpacePoint,
public readonly NodeAggregateIdentifiers $destinationNodeAggregateIdentifiers,
public readonly OriginDimensionSpacePointSet $affectedSourceOriginDimensionSpacePoints,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't fully understand why this now has an OriginDimensionSpacePointSet here :) -> Comment?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's for property scopes, a comment seems to be helpful

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment has been added

@@ -125,6 +125,7 @@ protected function getCurrentSubgraphs(): ContentSubgraphs
{
$currentSubgraphs = [];
foreach ($this->getActiveContentGraphs() as $adapterName => $contentGraph) {
$contentGraph->disableCache();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uh, why is this needed? I am not sure this is correct actually, but it might mask actual errors during the tests.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that you mention it, there seem to be caching issues that should be resolved instead. Will have a look at it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

): void {
$nodeType = $this->nodeTypeManager->getNodeType((string)$nodeTypeName);
// initialize node type
$nodeType->getOptions();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we still need this initialization?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, we don't :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has been removed

new NodeReferencesWereSet(
$command->contentStreamIdentifier,
$command->sourceNodeAggregateIdentifier,
$affectedOrigins,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, now I understand it. Still I guess we should add a comment in the event what the semantics of multiple affectedOrigins are.

return new SerializedPropertyValue(null, (string)$propertyType);
}
} catch (PropertyTypeIsInvalid $exception) {
if ($exception->getCode() === 1630063406 && $propertyValue === null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we somehow change this code? Especially checking for an exception code is weird here IMHO

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually resurrected that part of code from a dead path...
Maybe we can simply remove the outer try/catch.
The original idea from $back then is that by setting a non existent property to null we would be able to unset the property altogether. That didn't survive the introduction of property checks though and has zero test coverage. So... should we just drop it? Unsetting obsolete properties is covered by integrity checks I think

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "unset properties" feature has been restored on command level, tests will follow in a later PR

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nezaniel awesome :) Thanks!

@skurfuerst skurfuerst changed the title Reference properties ES CR: Reference properties Jul 23, 2022
Copy link
Member

@skurfuerst skurfuerst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GREAT :) :) :)

@skurfuerst skurfuerst merged commit 9864b2f into 9.0 Jul 25, 2022
@skurfuerst skurfuerst deleted the referenceProperties branch July 25, 2022 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants