Skip to content

Commit

Permalink
TASK: Rename $node->nodeName to $node->name
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed May 18, 2024
1 parent ec803ee commit e28fc44
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static function fromSubgraphAndStartNode(ContentSubgraphInterface $subgra
return new self(
$sourceNode->aggregateId,
$sourceNode->nodeTypeName,
$sourceNode->nodeName,
$sourceNode->name,
$sourceNode->classification,
$properties->serialized(),
NodeReferencesSnapshot::fromReferences(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ public static function fromLeafNodeAndAncestors(Node $leafNode, Nodes $ancestors
if ($ancestor->classification->isRoot()) {
continue;
}
if (!$ancestor->nodeName) {
if (!$ancestor->name) {
throw new \InvalidArgumentException(
'Could not resolve node path for node ' . $leafNode->aggregateId->value
. ', ancestor ' . $ancestor->aggregateId->value . ' is unnamed.',
1687509348
);
}
$nodeNames[] = $ancestor->nodeName;
$nodeNames[] = $ancestor->name;
}

return new self(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function findChildNodes(NodeAggregateId $parentNodeAggregateId, FindChild
}
$childNodes = $this->wrappedContentSubgraph->findChildNodes($parentNodeAggregateId, $filter);
foreach ($childNodes as $node) {
$namedChildNodeCache->add($parentNodeAggregateId, $node->nodeName, $node);
$namedChildNodeCache->add($parentNodeAggregateId, $node->name, $node);
$parentNodeIdCache->add($node->aggregateId, $parentNodeAggregateId);
$nodeByIdCache->add($node->aggregateId, $node);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function evaluate(FlowQuery $flowQuery, array $arguments)
protected function matchesPropertyNameFilter($element, $propertyNameFilter)
{
assert($element instanceof Node);
return $element->nodeName?->value === $propertyNameFilter;
return $element->name?->value === $propertyNameFilter;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ function () use ($tetheredNodeAggregate) {
$actualTetheredChildNodes = [];
foreach ($childNodes as $childNode) {
if ($childNode->classification->isTethered()) {
assert($childNode->nodeName !== null); // it's tethered!
$actualTetheredChildNodes[$childNode->nodeName->value] = $childNode;
assert($childNode->name !== null); // it's tethered!
$actualTetheredChildNodes[$childNode->name->value] = $childNode;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ public function theCommandChangeNodeAggregateNameIsExecutedWithPayloadAndExcepti
public function iExpectTheNodeToHaveTheName(string $nodeAggregateId, string $nodeName)
{
$node = $this->getCurrentSubgraph()->findNodeById(NodeAggregateId::fromString($nodeAggregateId));
Assert::assertEquals($nodeName, $node->nodeName->value, 'Node Names do not match');
Assert::assertEquals($nodeName, $node->name->value, 'Node Names do not match');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ public function iExpectThisNodeToBeNamed(string $serializedExpectedNodeName): vo
{
$expectedNodeName = NodeName::fromString($serializedExpectedNodeName);
$this->assertOnCurrentNode(function (Node $currentNode) use ($expectedNodeName) {
$actualNodeName = $currentNode->nodeName;
$actualNodeName = $currentNode->name;
Assert::assertSame($expectedNodeName->value, $actualNodeName->value, 'Actual node name "' . $actualNodeName->value . '" does not match expected "' . $expectedNodeName->value . '"');
});
}
Expand All @@ -326,7 +326,7 @@ public function iExpectThisNodeToBeNamed(string $serializedExpectedNodeName): vo
public function iExpectThisNodeToBeUnnamed(): void
{
$this->assertOnCurrentNode(function (Node $currentNode) {
Assert::assertNull($currentNode->nodeName, 'Node was not expected to be named');
Assert::assertNull($currentNode->name, 'Node was not expected to be named');
});
}

Expand Down Expand Up @@ -558,7 +558,7 @@ public function iExpectThisNodeToBeTheChildOfNode(string $serializedParentNodeDi
Assert::assertTrue($expectedParentDiscriminator->equals($actualParentDiscriminator), 'Parent discriminator does not match. Expected was ' . json_encode($expectedParentDiscriminator) . ', given was ' . json_encode($actualParentDiscriminator));

$expectedChildDiscriminator = NodeDiscriminator::fromNode($currentNode);
$child = $subgraph->findNodeByPath($currentNode->nodeName, $parent->aggregateId);
$child = $subgraph->findNodeByPath($currentNode->name, $parent->aggregateId);
$actualChildDiscriminator = NodeDiscriminator::fromNode($child);
Assert::assertTrue($expectedChildDiscriminator->equals($actualChildDiscriminator), 'Child discriminator does not match. Expected was ' . json_encode($expectedChildDiscriminator) . ', given was ' . json_encode($actualChildDiscriminator));
});
Expand Down Expand Up @@ -593,7 +593,7 @@ public function iExpectThisNodeToHaveTheFollowingChildNodes(TableNode $expectedC

foreach ($expectedChildNodesTable->getHash() as $index => $row) {
$expectedNodeName = NodeName::fromString($row['Name']);
$actualNodeName = $actualChildNodes[$index]->nodeName;
$actualNodeName = $actualChildNodes[$index]->name;
Assert::assertTrue($expectedNodeName->equals($actualNodeName), 'ContentSubgraph::findChildNodes: Node name in index ' . $index . ' does not match. Expected: "' . $expectedNodeName->value . '" Actual: "' . $actualNodeName->value . '"');
if (isset($row['NodeDiscriminator'])) {
$expectedNodeDiscriminator = NodeDiscriminator::fromShorthand($row['NodeDiscriminator']);
Expand Down
2 changes: 1 addition & 1 deletion Neos.Media.Browser/Classes/Controller/UsageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public function relatedNodesAction(AssetInterface $asset)
}
foreach ($existingSites as $existingSite) {
/** @var Site $existingSite * */
if ($siteNode->nodeName->equals($existingSite->getNodeName()->toNodeName())) {
if ($siteNode->name->equals($existingSite->getNodeName()->toNodeName())) {
$site = $existingSite;
}
}
Expand Down
4 changes: 2 additions & 2 deletions Neos.Neos/Classes/Controller/Frontend/NodeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,10 @@ private static function fillCacheInternal(
= $inMemoryCache->getParentNodeIdByChildNodeIdCache();
$namedChildNodeByNodeIdentifierCache = $inMemoryCache->getNamedChildNodeByNodeIdCache();
$allChildNodesByNodeIdentifierCache = $inMemoryCache->getAllChildNodesByNodeIdCache();
if ($node->nodeName !== null) {
if ($node->name !== null) {
$namedChildNodeByNodeIdentifierCache->add(
$parentNode->aggregateId,
$node->nodeName,
$node->name,
$node
);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ protected function computeSiteChanges(Workspace $selectedWorkspace, ContentRepos
$nodePathSegments = [];
$documentPathSegments = [];
foreach ($ancestors as $ancestor) {
$pathSegment = $ancestor->nodeName ?: NodeName::fromString($ancestor->aggregateId->value);
$pathSegment = $ancestor->name ?: NodeName::fromString($ancestor->aggregateId->value);
// Don't include `sites` path as they are not needed
// by the HTML/JS magic and won't be included as `$documentPathSegments`
if (!$this->getNodeType($ancestor)->isOfType(NodeTypeNameFactory::NAME_SITES)) {
Expand All @@ -797,8 +797,8 @@ protected function computeSiteChanges(Workspace $selectedWorkspace, ContentRepos

// Neither $documentNode, $siteNode or its cannot really be null, this is just for type checks;
// We should probably throw an exception though
if ($documentNode !== null && $siteNode !== null && $siteNode->nodeName) {
$siteNodeName = $siteNode->nodeName->value;
if ($documentNode !== null && $siteNode !== null && $siteNode->name) {
$siteNodeName = $siteNode->name->value;
// Reverse `$documentPathSegments` to start with the site node.
// The paths are used for grouping the nodes and for selecting a tree of nodes.
$documentPath = implode('/', array_reverse(array_map(
Expand Down
6 changes: 3 additions & 3 deletions Neos.Neos/Classes/Domain/Repository/SiteRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ public function findSiteBySiteNode(Node $siteNode): Site
if (!$this->getNodeType($siteNode)->isOfType(NodeTypeNameFactory::NAME_SITE)) {
throw new \Neos\Neos\Domain\Exception(sprintf('Node %s is not a site node. Site nodes must be of type "%s".', $siteNode->aggregateId->value, NodeTypeNameFactory::NAME_SITE), 1697108987);
}
if ($siteNode->nodeName === null) {
if ($siteNode->name === null) {
throw new \Neos\Neos\Domain\Exception(sprintf('Site node "%s" is unnamed', $siteNode->aggregateId->value), 1681286146);
}
return $this->findOneByNodeName(SiteNodeName::fromNodeName($siteNode->nodeName))
?? throw new \Neos\Neos\Domain\Exception(sprintf('No site found for nodeNodeName "%s"', $siteNode->nodeName->value), 1677245517);
return $this->findOneByNodeName(SiteNodeName::fromNodeName($siteNode->name))
?? throw new \Neos\Neos\Domain\Exception(sprintf('No site found for nodeNodeName "%s"', $siteNode->name->value), 1677245517);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions Neos.Neos/Classes/Domain/Service/SiteService.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ public function assignUploadedAssetToSiteAssetCollection(Asset $asset, Node $nod
// should not happen
return;
}
if ($siteNode->nodeName === null) {
if ($siteNode->name === null) {
return;
}
$site = $this->siteRepository->findOneByNodeName($siteNode->nodeName->value);
$site = $this->siteRepository->findOneByNodeName($siteNode->name->value);
if ($site === null) {
return;
}
Expand Down
4 changes: 2 additions & 2 deletions Neos.Neos/Classes/Fusion/Helper/NodeLabelToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ protected function resolveLabelFromNodeType(): void
$this->label = $this->node->nodeTypeName->value;
}

if (empty($this->postfix) && $this->node->nodeName !== null && $this->node->classification->isTethered()) {
$this->postfix = ' (' . $this->node->nodeName->value . ')';
if (empty($this->postfix) && $this->node->name !== null && $this->node->classification->isTethered()) {
$this->postfix = ' (' . $this->node->name->value . ')';
}
}

Expand Down
2 changes: 1 addition & 1 deletion Neos.Neos/Classes/Presentation/VisualNodePath.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static function fromAncestors(Node $leafNode, Nodes $ancestors): self
{
$pathSegments = [];
foreach ($ancestors->reverse() as $ancestor) {
$pathSegments[] = $ancestor->nodeName?->value ?: '[' . $ancestor->aggregateId->value . ']';
$pathSegments[] = $ancestor->name?->value ?: '[' . $ancestor->aggregateId->value . ']';
}

return new self('/' . implode('/', $pathSegments));
Expand Down
2 changes: 1 addition & 1 deletion Neos.Neos/Classes/Utility/NodeUriPathSegmentGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function generateUriPathSegment(?Node $node = null, ?string $text = null)
{
$language = null;
if ($node) {
$text = $text ?: $this->nodeLabelGenerator->getLabel($node) ?: ($node->nodeName?->value ?? '');
$text = $text ?: $this->nodeLabelGenerator->getLabel($node) ?: ($node->name?->value ?? '');
$languageDimensionValue = $node->originDimensionSpacePoint->coordinates['language'] ?? null;
if (!is_null($languageDimensionValue)) {
$locale = new Locale($languageDimensionValue);
Expand Down

0 comments on commit e28fc44

Please sign in to comment.