-
-
Notifications
You must be signed in to change notification settings - Fork 224
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
FEATURE: ContentGraphAdapter for write side access #4979
Closed
Closed
Changes from 4 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
aff3291
FEATURE: ContentGraphAdapter for write side access
kitsunet 4dd0880
Make ContentGraphAdapterFactory configurable
kitsunet 606a85b
Introduce ContentGraphAdapterProvider
kitsunet c7480fe
Introduce ContentGraphAdapterProviderInterface
kitsunet 2f05745
ContentGraphAdapter working implementation
kitsunet c184bee
Merge branch '9.0' into feature/content-graph-adapter-4973
kitsunet 590d143
Linting and Naming ContentGraphAdapter
kitsunet 1b1f386
More code cleanup
kitsunet 6d501b2
Code renaming and refinement
kitsunet a55e6c8
linter fix
kitsunet 4af5126
Use ContentGraphAdapter in SiteServiceInternals
kitsunet dd30d55
Query deduplication part 1
kitsunet 027cb02
Query deduplication part 2
kitsunet dad8756
More cleanup
kitsunet 87d6336
Fix that phpstan doesn't understand condition
kitsunet 8d580b8
Cleanup
kitsunet 2f8bfe5
Make factory signature clearer
kitsunet 9826f99
Linter fixes
kitsunet 0bed8c2
Merge branch '9.0' into feature/content-graph-adapter-4973
kitsunet bcf77d7
Add ContentGraphTableNames
kitsunet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
148 changes: 148 additions & 0 deletions
148
Neos.ContentGraph.DoctrineDbalAdapter/src/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,148 @@ | ||
<?php | ||
namespace Neos\ContentGraph\DoctrineDbalAdapter; | ||
|
||
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\Projection\ContentGraph\Nodes; | ||
use Neos\ContentRepository\Core\Projection\Workspace\Workspace; | ||
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\ContentStreamState; | ||
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; | ||
use Neos\EventStore\Model\EventStream\MaybeVersion; | ||
|
||
/** | ||
* | ||
*/ | ||
class ContentGraphAdapter implements ContentGraphAdapterInterface | ||
{ | ||
private NodeFactory $nodeFactory; | ||
|
||
public function __construct( | ||
private readonly Connection $dbalConnection, | ||
private readonly string $tableNamePrefix, | ||
public readonly ContentStreamId $contentStreamId, | ||
public readonly WorkspaceName $workspaceName | ||
) | ||
{ | ||
} | ||
|
||
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): Nodesy | ||
{ | ||
// 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. | ||
} | ||
|
||
private function getTablenameForNode(): string | ||
{ | ||
return $this->tableNamePrefix . '_node'; | ||
} | ||
|
||
private function getTablenameForHierachyRelation(): string | ||
{ | ||
return $this->tableNamePrefix . '_hierarchyrelation'; | ||
} | ||
|
||
private function getTablenameForDimensionSpacePoints(): string | ||
{ | ||
return $this->tableNamePrefix . '_dimensionspacepoints'; | ||
} | ||
|
||
|
||
} |
36 changes: 36 additions & 0 deletions
36
Neos.ContentGraph.DoctrineDbalAdapter/src/ContentGraphAdapterProvider.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,36 @@ | ||
<?php | ||
namespace Neos\ContentGraph\DoctrineDbalAdapter; | ||
|
||
use Doctrine\DBAL\Connection; | ||
use Neos\ContentRepository\Core\Feature\ContentGraphAdapterInterface; | ||
use Neos\ContentRepository\Core\Feature\ContentGraphAdapterProviderInterface; | ||
use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; | ||
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; | ||
|
||
/** | ||
* @api | ||
*/ | ||
class ContentGraphAdapterProvider implements ContentGraphAdapterProviderInterface | ||
{ | ||
public function __construct( | ||
private readonly Connection $dbalConnection, | ||
private readonly string $tableNamePrefix, | ||
) { | ||
} | ||
|
||
public function resolveWorkspaceNameAndGet(ContentStreamId $contentStreamId): ContentGraphAdapterInterface | ||
{ | ||
// TODO: Implement resolveWorkspaceNameAndGet() method. | ||
} | ||
|
||
public function resolveContentStreamIdAndGet(WorkspaceName $workspaceName): ContentGraphAdapterInterface | ||
{ | ||
// TODO: Implement resolveContentStreamIdAndGet() method. | ||
} | ||
|
||
public function overrideContentStreamId(WorkspaceName $workspaceName, ContentStreamId $contentStreamId, \Closure $fn): void | ||
{ | ||
// TODO: Implement overrideContentStreamId() method. | ||
} | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
Neos.ContentGraph.DoctrineDbalAdapter/src/ContentGraphAdapterProviderFactory.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,26 @@ | ||
<?php | ||
namespace Neos\ContentGraph\DoctrineDbalAdapter; | ||
|
||
use Doctrine\DBAL\Connection; | ||
use Neos\ContentRepository\Core\Feature\ContentGraphAdapterProviderFactoryInterface; | ||
use Neos\ContentRepository\Core\Feature\ContentGraphAdapterProviderInterface; | ||
use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId; | ||
|
||
/** | ||
* This factory resolves low level dependencies for the ContentGraphAdapterProvider implementation | ||
*/ | ||
class ContentGraphAdapterProviderFactory implements ContentGraphAdapterProviderFactoryInterface | ||
{ | ||
public function __construct( | ||
readonly Connection $dbalConnection | ||
) { | ||
} | ||
|
||
public function build(ContentRepositoryId $contentRepositoryId, array $options): ContentGraphAdapterProviderInterface | ||
{ | ||
$tableNamePrefix = DoctrineDbalContentGraphProjectionFactory::graphProjectionTableNamePrefix( | ||
$contentRepositoryId | ||
); | ||
return new ContentGraphAdapterProvider($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
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should refine this naming