Skip to content

Commit

Permalink
Fix more usages
Browse files Browse the repository at this point in the history
  • Loading branch information
bwaidelich committed Apr 1, 2023
1 parent 88cb1fd commit 3fbf9fd
Show file tree
Hide file tree
Showing 16 changed files with 51 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,9 @@ private function whenRootNodeAggregateDimensionsWereUpdated(RootNodeAggregateDim
AND childnodeanchor = :childNodeAnchor
AND contentstreamid = :contentStreamId
', [
'parentNodeAnchor' => (string)NodeRelationAnchorPoint::forRootEdge(),
'childNodeAnchor' => (string)$rootNodeAnchorPoint,
'contentStreamId' => $event->contentStreamId->value
'parentNodeAnchor' => NodeRelationAnchorPoint::forRootEdge()->value,
'childNodeAnchor' => $rootNodeAnchorPoint->value,
'contentStreamId' => $event->contentStreamId->value,
]);
// recreate hierarchy edges for the root node
$this->connectHierarchy(
Expand Down Expand Up @@ -617,7 +617,7 @@ protected function getRelationPositionAfterRecalculation(
$offset += self::RELATION_DEFAULT_OFFSET;
if (
$succeedingSiblingAnchorPoint
&& (string)$relation->childNodeAnchor === (string)$succeedingSiblingAnchorPoint
&& $relation->childNodeAnchor->equals($succeedingSiblingAnchorPoint)
) {
$position = $offset;
$offset += self::RELATION_DEFAULT_OFFSET;
Expand Down Expand Up @@ -1067,9 +1067,9 @@ protected function updateNodeRecordWithCopyOnWrite(
:originalNodeAnchor IN (h.childnodeanchor, h.parentnodeanchor)
AND h.contentstreamid = :contentStreamId',
[
'newNodeAnchor' => (string)$copiedNode->relationAnchorPoint,
'originalNodeAnchor' => (string)$anchorPoint,
'contentStreamId' => $contentStreamIdWhereWriteOccurs->value
'newNodeAnchor' => $copiedNode->relationAnchorPoint->value,
'originalNodeAnchor' => $anchorPoint->value,
'contentStreamId' => $contentStreamIdWhereWriteOccurs->value,
]
);

Expand Down Expand Up @@ -1113,8 +1113,8 @@ protected function copyReferenceRelations(
' . $this->tableNamePrefix . '_referencerelation ref
WHERE ref.nodeanchorpoint = :sourceNodeAnchorPoint
', [
'sourceNodeAnchorPoint' => (string)$sourceRelationAnchorPoint,
'destinationRelationAnchorPoint' => (string)$destinationRelationAnchorPoint
'sourceNodeAnchorPoint' => $sourceRelationAnchorPoint->value,
'destinationRelationAnchorPoint' => $destinationRelationAnchorPoint->value
]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct(
public static function graphProjectionTableNamePrefix(
ContentRepositoryId $contentRepositoryId
): string {
return sprintf('cr_%s_p_graph', $contentRepositoryId);
return sprintf('cr_%s_p_graph', $contentRepositoryId->value);
}

public function build(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
*
* @internal
*/
class NodeRelationAnchorPoint implements \JsonSerializable, \Stringable
class NodeRelationAnchorPoint implements \JsonSerializable
{
private function __construct(
private string $value
public readonly string $value
) {
}

Expand All @@ -48,8 +48,8 @@ public function jsonSerialize(): string
return $this->value;
}

public function __toString(): string
public function equals(self $other): bool
{
return $this->value;
return $other->value === $this->value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ public function knowsAbout(NodeAggregateId $nodeAggregateId): bool
return false;
}

$key = $nodeAggregateId->value;
return isset($this->nodes[$key]) || isset($this->nonExistingNodeAggregateIds[$key]);
return isset($this->nodes[$nodeAggregateId->value]) || isset($this->nonExistingNodeAggregateIds[$nodeAggregateId->value]);
}

public function add(NodeAggregateId $nodeAggregateId, Node $node): void
Expand All @@ -62,8 +61,7 @@ public function add(NodeAggregateId $nodeAggregateId, Node $node): void
return;
}

$key = $nodeAggregateId->value;
$this->nodes[$key] = $node;
$this->nodes[$nodeAggregateId->value] = $node;
}

public function rememberNonExistingNodeAggregateId(NodeAggregateId $nodeAggregateId): void
Expand All @@ -72,8 +70,7 @@ public function rememberNonExistingNodeAggregateId(NodeAggregateId $nodeAggregat
return;
}

$key = $nodeAggregateId->value;
$this->nonExistingNodeAggregateIds[$key] = true;
$this->nonExistingNodeAggregateIds[$nodeAggregateId->value] = true;
}

public function get(NodeAggregateId $nodeAggregateId): ?Node
Expand All @@ -82,7 +79,6 @@ public function get(NodeAggregateId $nodeAggregateId): ?Node
return null;
}

$key = $nodeAggregateId->value;
return $this->nodes[$key] ?? null;
return $this->nodes[$nodeAggregateId->value] ?? null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ public function add(NodeAggregateId $childNodeAggregateId, NodeAggregateId $pare
return;
}

$key = $childNodeAggregateId->value;
$this->parentNodeAggregateIds[$key] = $parentNodeAggregateId;
$this->parentNodeAggregateIds[$childNodeAggregateId->value] = $parentNodeAggregateId;
}

public function knowsAbout(NodeAggregateId $childNodeAggregateId): bool
Expand All @@ -58,8 +57,7 @@ public function knowsAbout(NodeAggregateId $childNodeAggregateId): bool
return false;
}

$key = $childNodeAggregateId->value;
return isset($this->parentNodeAggregateIds[$key]) || isset($this->nodesWithoutParentNode[$key]);
return isset($this->parentNodeAggregateIds[$childNodeAggregateId->value]) || isset($this->nodesWithoutParentNode[$childNodeAggregateId->value]);
}

public function rememberNonExistingParentNode(NodeAggregateId $nodeAggregateId): void
Expand All @@ -68,8 +66,7 @@ public function rememberNonExistingParentNode(NodeAggregateId $nodeAggregateId):
return;
}

$key = $nodeAggregateId->value;
$this->nodesWithoutParentNode[$key] = true;
$this->nodesWithoutParentNode[$nodeAggregateId->value] = true;
}


Expand All @@ -79,7 +76,6 @@ public function get(NodeAggregateId $childNodeAggregateId): ?NodeAggregateId
return null;
}

$key = $childNodeAggregateId->value;
return $this->parentNodeAggregateIds[$key] ?? null;
return $this->parentNodeAggregateIds[$childNodeAggregateId->value] ?? null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function build(
$this->dbalClient,
sprintf(
'cr_%s_p_%s',
$projectionFactoryDependencies->contentRepositoryId,
$projectionFactoryDependencies->contentRepositoryId->value,
$projectionShortName
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function build(
$this->dbalClient,
sprintf(
'cr_%s_p_%s',
$projectionFactoryDependencies->contentRepositoryId,
$projectionFactoryDependencies->contentRepositoryId->value,
$projectionShortName
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,12 @@ public function findOneByName(WorkspaceName $name): ?Workspace
}

$connection = $this->client->getConnection();
$workspaceRow = $connection->executeQuery(
'
$workspaceRow = $connection->executeQuery('
SELECT * FROM ' . $this->tableName . '
WHERE workspaceName = :workspaceName
',
[
':workspaceName' => $name->value
'workspaceName' => $name->value,
]
)->fetchAssociative();

Expand Down Expand Up @@ -78,7 +77,7 @@ public function findOneByCurrentContentStreamId(
WHERE currentContentStreamId = :currentContentStreamId
',
[
':currentContentStreamId' => $contentStreamId->value
'currentContentStreamId' => $contentStreamId->value
]
)->fetchAssociative();

Expand All @@ -105,7 +104,7 @@ public function findByPrefix(WorkspaceName $prefix): array
WHERE workspaceName LIKE :workspaceNameLike
',
[
':workspaceNameLike' => $prefix->value . '%'
'workspaceNameLike' => $prefix->value . '%'
]
)->fetchAllAssociative();

Expand All @@ -132,7 +131,7 @@ public function findByBaseWorkspace(WorkspaceName $baseWorkspace): array
WHERE baseWorkspaceName = :workspaceName
',
[
':workspaceName' => $baseWorkspace->value
'workspaceName' => $baseWorkspace->value,
]
)->fetchAllAssociative();

Expand All @@ -153,7 +152,7 @@ public function findOneByWorkspaceOwner(string $owner): ?Workspace
WHERE workspaceOwner = :workspaceOwner
',
[
':workspaceOwner' => $owner
'workspaceOwner' => $owner
]
)->fetchAssociative();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function build(
$this->dbalClient,
sprintf(
'cr_%s_p_%s',
$projectionFactoryDependencies->contentRepositoryId,
$projectionFactoryDependencies->contentRepositoryId->value,
$projectionShortName
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
* source code.
*/

use Neos\ContentRepository\Core\NodeType\NodeTypeConstraintParser;
use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindChildNodesFilter;
use Neos\ContentRepository\Core\SharedModel\Node\NodeName;
use Neos\ContentRepository\Core\Projection\ContentGraph\NodeTypeConstraints;
Expand Down Expand Up @@ -201,8 +200,9 @@ protected function earlyOptimizationOfFilters(FlowQuery $flowQuery, array $parse
}

// Add filtered nodes to output
/** @var Node $filteredNode */
foreach ($filteredOutput as $filteredNode) {
if (!isset($outputNodeAggregateIds[(string)$filteredNode->nodeAggregateId])) {
if (!isset($outputNodeAggregateIds[$filteredNode->nodeAggregateId->value])) {
$output[] = $filteredNode;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function evaluate(FlowQuery $flowQuery, array $arguments)

foreach ($contextNodeQuery as $result) {
/* @var Node $result */
$output[(string)$result->nodeAggregateId] = $result;
$output[$result->nodeAggregateId->value] = $result;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ private function ensureNodeIsOfType(Node $node, NodeType $expectedNodeType): \Ge
yield StructureAdjustment::createForNode(
$node,
StructureAdjustment::TETHERED_NODE_TYPE_WRONG,
'should be of type "' . $expectedNodeType->name . '", but was "' . $node->nodeTypeName->value . '".'
'should be of type "' . $expectedNodeType->name->value . '", but was "' . $node->nodeTypeName->value . '".'
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ public function build(ContentRepositoryId $contentRepositoryId , array $content

public static function databaseTableName(ContentRepositoryId $contentRepositoryId): string
{
return sprintf('cr_%s_events', $contentRepositoryId);
return sprintf('cr_%s_events', $contentRepositoryId->value);
}
}
31 changes: 13 additions & 18 deletions Neos.Neos/Classes/Controller/Frontend/NodeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,33 @@

namespace Neos\Neos\Controller\Frontend;

use Neos\ContentGraph\DoctrineDbalAdapter\Domain\Repository\ContentSubgraph;
use Neos\ContentRepository\Core\ContentRepository;
use Neos\ContentRepository\Core\Projection\ContentGraph\ContentGraphWithRuntimeCaches\ContentSubgraphWithRuntimeCaches;
use Neos\ContentRepository\Core\Projection\ContentGraph\ContentGraphWithRuntimeCaches\InMemoryCache;
use Neos\ContentRepository\Core\Projection\ContentGraph\ContentSubgraphInterface;
use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindSubtreeFilter;
use Neos\ContentRepository\Core\Projection\ContentGraph\Nodes;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId;
use Neos\ContentRepository\Core\Projection\ContentGraph\NodePath;
use Neos\ContentRepository\Core\NodeType\NodeTypeConstraintParser;
use Neos\Neos\FrontendRouting\NodeAddressFactory;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateIds;
use Neos\ContentRepository\Core\Projection\ContentGraph\Node;
use Neos\ContentRepository\Core\Projection\ContentGraph\NodePath;
use Neos\ContentRepository\Core\Projection\ContentGraph\Nodes;
use Neos\ContentRepository\Core\Projection\ContentGraph\Subtree;
use Neos\Neos\FrontendRouting\NodeAddress;
use Neos\ContentRepository\Core\Projection\ContentGraph\NodeTypeConstraints;
use Neos\ContentRepository\Core\Projection\ContentGraph\NodeTypeConstraintsWithSubNodeTypes;
use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints;
use Neos\ContentRepository\Core\Projection\ContentGraph\ContentSubgraphInterface;
use Neos\ContentRepository\Core\Projection\ContentGraph\ContentGraphWithRuntimeCaches\InMemoryCache;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
use Neos\Neos\FrontendRouting\Exception\NodeNotFoundException;
use Neos\Neos\FrontendRouting\NodeShortcutResolver;
use Neos\Neos\Domain\Service\NodeSiteResolvingService;
use Neos\Flow\Security\Authorization\PrivilegeManagerInterface;
use Neos\Neos\FrontendRouting\Exception\InvalidShortcutException;
use Neos\Neos\FrontendRouting\NodeUriBuilder;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Mvc\Controller\ActionController;
use Neos\Flow\Mvc\Exception\NoMatchingRouteException;
use Neos\Flow\Property\PropertyMapper;
use Neos\Flow\Security\Authorization\PrivilegeManagerInterface;
use Neos\Flow\Security\Context as SecurityContext;
use Neos\Flow\Session\SessionInterface;
use Neos\Flow\Utility\Now;
use Neos\Neos\Domain\Service\NodeSiteResolvingService;
use Neos\Neos\FrontendRouting\Exception\InvalidShortcutException;
use Neos\Neos\FrontendRouting\Exception\NodeNotFoundException;
use Neos\Neos\FrontendRouting\NodeAddress;
use Neos\Neos\FrontendRouting\NodeAddressFactory;
use Neos\Neos\FrontendRouting\NodeShortcutResolver;
use Neos\Neos\FrontendRouting\NodeUriBuilder;
use Neos\Neos\FrontendRouting\SiteDetection\SiteDetectionResult;
use Neos\Neos\View\FusionView;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static function projectionTableNamePrefix(
)
);

return sprintf('cr_%s_p_neos_%s', $contentRepositoryId, $projectionShortName);
return sprintf('cr_%s_p_neos_%s', $contentRepositoryId->value, $projectionShortName);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function build(
$workspaceFinder,
sprintf(
'cr_%s_p_neos_%s',
$projectionFactoryDependencies->contentRepositoryId,
$projectionFactoryDependencies->contentRepositoryId->value,
$projectionShortName
),
);
Expand Down

0 comments on commit 3fbf9fd

Please sign in to comment.