Skip to content

Commit

Permalink
TASK: Remove uri from TreeNode DTO
Browse files Browse the repository at this point in the history
  • Loading branch information
grebaldi committed May 6, 2024
1 parent a7e5202 commit abf4272
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

namespace Sitegeist\Archaeopteryx\Application\GetChildrenForTreeNode;

use GuzzleHttp\Psr7\Uri;
use Neos\ContentRepository\Domain\Model\Node;
use Neos\ContentRepository\Domain\Model\NodeType;
use Neos\ContentRepository\Domain\NodeType\NodeTypeName;
Expand Down Expand Up @@ -71,7 +70,6 @@ private function createTreeNodeFromNode(Node $node, GetChildrenForTreeNodeQuery
{
return new TreeNode(
nodeAggregateIdentifier: $node->getNodeAggregateIdentifier(),
uri: new Uri('node://' . $node->getNodeAggregateIdentifier()),
icon: $node->getNodeType()->getConfiguration('ui.icon'),
label: $node->getLabel(),
nodeTypeLabel: $node->getNodeType()->getLabel(),
Expand Down
7 changes: 1 addition & 6 deletions Classes/Application/Shared/TreeNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

use Neos\ContentRepository\Domain\NodeAggregate\NodeAggregateIdentifier;
use Neos\ContentRepository\Domain\NodeType\NodeTypeName;
use Psr\Http\Message\UriInterface;
use Neos\Flow\Annotations as Flow;

/**
Expand All @@ -28,7 +27,6 @@ final class TreeNode implements \JsonSerializable
*/
public function __construct(
public readonly NodeAggregateIdentifier $nodeAggregateIdentifier,
public readonly UriInterface $uri,
public readonly string $icon,
public readonly string $label,
public readonly string $nodeTypeLabel,
Expand All @@ -44,10 +42,7 @@ public function __construct(

public function jsonSerialize(): mixed
{
$result = get_object_vars($this);
$result['uri'] = (string) $result['uri'];

return $result;
return get_object_vars($this);
}

/**
Expand Down
5 changes: 0 additions & 5 deletions Classes/Application/Shared/TreeNodeBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@

namespace Sitegeist\Archaeopteryx\Application\Shared;

use GuzzleHttp\Psr7\Uri;
use Neos\ContentRepository\Domain\Model\Node;
use Neos\ContentRepository\Domain\Model\NodeType;
use Neos\ContentRepository\Domain\NodeAggregate\NodeAggregateIdentifier;
use Neos\ContentRepository\Domain\NodeType\NodeTypeName;
use Psr\Http\Message\UriInterface;
use Neos\Flow\Annotations as Flow;

/**
Expand All @@ -36,7 +34,6 @@ final class TreeNodeBuilder
private function __construct(
public readonly int $sortingIndex,
private NodeAggregateIdentifier $nodeAggregateIdentifier,
private UriInterface $uri,
private string $icon,
private string $label,
private string $nodeTypeLabel,
Expand All @@ -56,7 +53,6 @@ public static function fromNode(Node $node): self
// @phpstan-ignore-next-line
sortingIndex: $node->getIndex() ?? 0,
nodeAggregateIdentifier: $node->getNodeAggregateIdentifier(),
uri: new Uri('node://' . $node->getNodeAggregateIdentifier()),
icon: $node->getNodeType()->getConfiguration('ui.icon') ?? 'questionmark',
label: $node->getLabel(),
nodeTypeLabel: $node->getNodeType()->getLabel(),
Expand Down Expand Up @@ -101,7 +97,6 @@ public function build(): TreeNode
{
return new TreeNode(
nodeAggregateIdentifier: $this->nodeAggregateIdentifier,
uri: $this->uri,
icon: $this->icon,
label: $this->label,
nodeTypeLabel: $this->nodeTypeLabel,
Expand Down
1 change: 0 additions & 1 deletion Neos.Ui/custom-node-tree/src/domain/TreeNodeDTO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/
export type TreeNodeDTO = {
nodeAggregateIdentifier: string;
uri: string;
icon: string;
label: string;
nodeTypeLabel: string;
Expand Down

0 comments on commit abf4272

Please sign in to comment.