forked from neos/neos-development-collection
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FEATURE: ContentGraphAdapter for write side access
The write side no longer uses any regular finders for checks but only accesses projection data via the new `ContentGraphAdapterInterface`. Fixes: neos#4973
- Loading branch information
Showing
29 changed files
with
817 additions
and
613 deletions.
There are no files selected for viewing
123 changes: 123 additions & 0 deletions
123
Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ContentGraphAdapter.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
<?php | ||
namespace Neos\ContentGraph\DoctrineDbalAdapter\Domain\Repository; | ||
|
||
use Doctrine\DBAL\Connection; | ||
use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint; | ||
use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePointSet; | ||
use Neos\ContentRepository\Core\DimensionSpace\OriginDimensionSpacePoint; | ||
use Neos\ContentRepository\Core\Feature\ContentGraphAdapterInterface; | ||
use Neos\ContentRepository\Core\NodeType\NodeTypeName; | ||
use Neos\ContentRepository\Core\Projection\ContentGraph\Node; | ||
use Neos\ContentRepository\Core\Projection\ContentGraph\NodeAggregate; | ||
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; | ||
use Neos\ContentRepository\Core\SharedModel\Node\NodeName; | ||
use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; | ||
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; | ||
|
||
/** | ||
* | ||
*/ | ||
class ContentGraphAdapter implements ContentGraphAdapterInterface | ||
{ | ||
public function __construct( | ||
private readonly Connection $dbalConnection, | ||
private readonly string $tableNamePrefix | ||
) | ||
{ | ||
} | ||
|
||
public function rootNodeAggregateWithTypeExists(ContentStreamId $contentStreamId, NodeTypeName $nodeTypeName): bool | ||
{ | ||
// TODO: Implement rootNodeAggregateWithTypeExists() method. | ||
} | ||
|
||
public function findParentNodeAggregates(ContentStreamId $contentStreamId, WorkspaceName $workspaceName, NodeAggregateId $childNodeAggregateId): iterable | ||
{ | ||
// TODO: Implement findParentNodeAggregates() method. | ||
} | ||
|
||
public function findNodeAggregateById(ContentStreamId $contentStreamId, WorkspaceName $workspaceName, NodeAggregateId $nodeAggregateId): ?NodeAggregate | ||
{ | ||
// TODO: Implement findNodeAggregateById() method. | ||
} | ||
|
||
public function findParentNodeAggregateByChildOriginDimensionSpacePoint(ContentStreamId $contentStreamId, WorkspaceName $workspaceName, NodeAggregateId $childNodeAggregateId, OriginDimensionSpacePoint $childOriginDimensionSpacePoint): ?NodeAggregate | ||
{ | ||
// TODO: Implement findParentNodeAggregateByChildOriginDimensionSpacePoint() method. | ||
} | ||
|
||
public function findChildNodeAggregates(ContentStreamId $contentStreamId, WorkspaceName $workspaceName, NodeAggregateId $parentNodeAggregateId): iterable | ||
{ | ||
// TODO: Implement findChildNodeAggregates() method. | ||
} | ||
|
||
public function findTetheredChildNodeAggregates(ContentStreamId $contentStreamId, WorkspaceName $workspaceName, NodeAggregateId $parentNodeAggregateId): iterable | ||
{ | ||
// TODO: Implement findTetheredChildNodeAggregates() method. | ||
} | ||
|
||
public function getDimensionSpacePointsOccupiedByChildNodeName(ContentStreamId $contentStreamId, NodeName $nodeName, NodeAggregateId $parentNodeAggregateId, OriginDimensionSpacePoint $parentNodeOriginDimensionSpacePoint, DimensionSpacePointSet $dimensionSpacePointsToCheck): DimensionSpacePointSet | ||
{ | ||
// TODO: Implement getDimensionSpacePointsOccupiedByChildNodeName() method. | ||
} | ||
|
||
public function findChildNodeAggregatesByName(ContentStreamId $contentStreamId, WorkspaceName $workspaceName, NodeAggregateId $parentNodeAggregateId, NodeName $name): iterable | ||
{ | ||
// TODO: Implement findChildNodeAggregatesByName() method. | ||
} | ||
|
||
public function subgraphContainsNodes(ContentStreamId $contentStreamId, DimensionSpacePoint $dimensionSpacePoint): bool | ||
{ | ||
// TODO: Implement subgraphContainsNodes() method. | ||
} | ||
|
||
public function findNodeInSubgraph(ContentStreamId $contentStreamId, WorkspaceName $workspaceName, DimensionSpacePoint $coveredDimensionSpacePoint, NodeAggregateId $nodeAggregateId): ?Node | ||
{ | ||
// TODO: Implement findNodeInSubgraph() method. | ||
} | ||
|
||
public function findParentNodeInSubgraph(ContentStreamId $contentStreamId, WorkspaceName $workspaceName, DimensionSpacePoint $coveredDimensionSpacePoint, NodeAggregateId $childNodeAggregateId): ?Node | ||
{ | ||
// TODO: Implement findParentNodeInSubgraph() method. | ||
} | ||
|
||
public function findChildNodeByNameInSubgraph(ContentStreamId $contentStreamId, WorkspaceName $workspaceName, DimensionSpacePoint $coveredDimensionSpacePoint, NodeAggregateId $parentNodeAggregateId, NodeName $nodeNamex): ?Node | ||
{ | ||
// TODO: Implement findChildNodeByNameInSubgraph() method. | ||
} | ||
|
||
public function findPreceedingSiblingNodesInSubgraph(ContentStreamId $contentStreamId, WorkspaceName $workspaceName, DimensionSpacePoint $coveredDimensionSpacePoint, NodeAggregateId $startingSiblingNodeAggregateId): Nodes | ||
{ | ||
// TODO: Implement findPreceedingSiblingNodesInSubgraph() method. | ||
} | ||
|
||
public function findSuceedingSiblingNodesInSubgraph(ContentStreamId $contentStreamId, WorkspaceName $workspaceName, DimensionSpacePoint $coveredDimensionSpacePoint, NodeAggregateId $startingSiblingNodeAggregateId): Nodes | ||
{ | ||
// TODO: Implement findSuceedingSiblingNodesInSubgraph() method. | ||
} | ||
|
||
public function hasContentStream(ContentStreamId $contentStreamId): bool | ||
{ | ||
// TODO: Implement hasContentStream() method. | ||
} | ||
|
||
public function findStateForContentStream(ContentStreamId $contentStreamId): ?ContentStreamState | ||
{ | ||
// TODO: Implement findStateForContentStream() method. | ||
} | ||
|
||
public function findVersionForContentStream(ContentStreamId $contentStreamId): MaybeVersion | ||
{ | ||
// TODO: Implement findVersionForContentStream() method. | ||
} | ||
|
||
public function findWorkspaceByName(WorkspaceName $workspaceName): ?Workspace | ||
{ | ||
// TODO: Implement findWorkspaceByName() method. | ||
} | ||
|
||
public function findWorkspaceByCurrentContentStreamId(ContentStreamId $contentStreamId): ?Workspace | ||
{ | ||
// TODO: Implement findWorkspaceByCurrentContentStreamId() method. | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ContentGraphAdapterFactory.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
namespace Neos\ContentGraph\DoctrineDbalAdapter\Domain\Repository; | ||
|
||
use Doctrine\DBAL\Connection; | ||
use Neos\ContentGraph\DoctrineDbalAdapter\DoctrineDbalContentGraphProjectionFactory; | ||
use Neos\ContentRepository\Core\Feature\ContentGraphAdapterFactoryInterface; | ||
use Neos\ContentRepository\Core\Feature\ContentGraphAdapterInterface; | ||
use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId; | ||
|
||
/** | ||
* This factory | ||
*/ | ||
class ContentGraphAdapterFactory implements ContentGraphAdapterFactoryInterface | ||
{ | ||
public function __construct( | ||
readonly Connection $dbalConnection | ||
) { | ||
} | ||
|
||
public function build(ContentRepositoryId $contentRepositoryId): ContentGraphAdapterInterface | ||
{ | ||
$tableNamePrefix = DoctrineDbalContentGraphProjectionFactory::graphProjectionTableNamePrefix( | ||
$contentRepositoryId | ||
); | ||
return new ContentGraphAdapter($this->dbalConnection, $tableNamePrefix); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.