-
-
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
Changes from all commits
aff3291
4dd0880
606a85b
c7480fe
2f05745
c184bee
590d143
1b1f386
6d501b2
a55e6c8
4af5126
dd30d55
027cb02
dad8756
87d6336
8d580b8
2f8bfe5
9826f99
0bed8c2
bcf77d7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
namespace Neos\ContentGraph\DoctrineDbalAdapter; | ||
|
||
use Doctrine\DBAL\Connection; | ||
use Neos\ContentGraph\DoctrineDbalAdapter\Domain\Repository\DimensionSpacePointsRepository; | ||
use Neos\ContentGraph\DoctrineDbalAdapter\Domain\Repository\NodeFactory; | ||
use Neos\ContentRepository\Core\Feature\ContentGraphAdapterFactoryInterface; | ||
use Neos\ContentRepository\Core\Feature\ContentGraphAdapterInterface; | ||
use Neos\ContentRepository\Core\Infrastructure\Property\PropertyConverter; | ||
use Neos\ContentRepository\Core\NodeType\NodeTypeManager; | ||
use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId; | ||
use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; | ||
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; | ||
|
||
/** | ||
* Factory for the ContentGraphAdapter implementation for doctrine DBAL | ||
* | ||
* @internal | ||
*/ | ||
class ContentGraphAdapterFactory implements ContentGraphAdapterFactoryInterface | ||
{ | ||
private NodeFactory $nodeFactory; | ||
|
||
private string $tableNamePrefix; | ||
|
||
public function __construct( | ||
private readonly Connection $dbalConnection, | ||
private readonly ContentRepositoryId $contentRepositoryId, | ||
NodeTypeManager $nodeTypeManager, | ||
PropertyConverter $propertyConverter | ||
) { | ||
$this->tableNamePrefix = DoctrineDbalContentGraphProjectionFactory::graphProjectionTableNamePrefix( | ||
$contentRepositoryId | ||
); | ||
|
||
$dimensionSpacePointsRepository = new DimensionSpacePointsRepository($this->dbalConnection, $this->tableNamePrefix); | ||
$this->nodeFactory = new NodeFactory( | ||
$contentRepositoryId, | ||
$nodeTypeManager, | ||
$propertyConverter, | ||
$dimensionSpacePointsRepository | ||
); | ||
} | ||
|
||
public function create(WorkspaceName $workspaceName, ContentStreamId $contentStreamId): ContentGraphAdapterInterface | ||
{ | ||
return new ContentGraphAdapter($this->dbalConnection, $this->tableNamePrefix, $this->contentRepositoryId, $this->nodeFactory, $workspaceName, $contentStreamId); | ||
} | ||
|
||
public function createFromContentStreamId(ContentStreamId $contentStreamId): ContentGraphAdapterInterface | ||
{ | ||
return new ContentGraphAdapter($this->dbalConnection, $this->tableNamePrefix, $this->contentRepositoryId, $this->nodeFactory, null, $contentStreamId); | ||
} | ||
|
||
public function createFromWorkspaceName(WorkspaceName $workspaceName): ContentGraphAdapterInterface | ||
{ | ||
return new ContentGraphAdapter($this->dbalConnection, $this->tableNamePrefix, $this->contentRepositoryId, $this->nodeFactory, $workspaceName, null); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace Neos\ContentGraph\DoctrineDbalAdapter; | ||
|
||
use Neos\ContentRepository\Core\Feature\ContentGraphAdapterFactoryBuilderInterface; | ||
use Neos\ContentRepository\Core\Feature\ContentGraphAdapterFactoryInterface; | ||
use Neos\ContentRepository\Core\Infrastructure\DbalClientInterface; | ||
use Neos\ContentRepository\Core\Infrastructure\Property\PropertyConverter; | ||
use Neos\ContentRepository\Core\NodeType\NodeTypeManager; | ||
use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId; | ||
|
||
/** | ||
* Builder to combine injected dependencies and ProjectionFActoryDependencies into a ContentGraphAdapterFactory | ||
* @internal | ||
*/ | ||
class ContentGraphAdapterFactoryBuilder implements ContentGraphAdapterFactoryBuilderInterface | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wouldn't mind getting around having this, and am happy for suggestions, I don't really see it though. An ugly option would be to to have something along the lines of:
and the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AFAIS we only need it to pass in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ..or even make the |
||
{ | ||
public function __construct(private readonly DbalClientInterface $dbalClient) | ||
{ | ||
} | ||
|
||
public function build(ContentRepositoryId $contentRepositoryId, NodeTypeManager $nodeTypeManager, PropertyConverter $propertyConverter): ContentGraphAdapterFactoryInterface | ||
{ | ||
return new ContentGraphAdapterFactory($this->dbalClient->getConnection(), $contentRepositoryId, $nodeTypeManager, $propertyConverter); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
namespace Neos\ContentGraph\DoctrineDbalAdapter; | ||
|
||
/** | ||
* Encapsulates table name generation for content graph tables | ||
* @internal | ||
*/ | ||
final class ContentGraphTableNames | ||
{ | ||
private function __construct(private readonly string $tableNamePrefix) | ||
{ | ||
} | ||
|
||
public static function withPrefix(string $tableNamePrefix): self | ||
{ | ||
return new self($tableNamePrefix); | ||
} | ||
|
||
public function node(): string | ||
{ | ||
return $this->tableNamePrefix . '_node'; | ||
} | ||
|
||
public function hierachyRelation(): string | ||
{ | ||
return $this->tableNamePrefix . '_hierarchyrelation'; | ||
} | ||
|
||
public function dimensionSpacePoints(): string | ||
{ | ||
return $this->tableNamePrefix . '_dimensionspacepoints'; | ||
} | ||
|
||
public function referenceRelation(): string | ||
{ | ||
return $this->tableNamePrefix . '_referencerelation'; | ||
} | ||
|
||
public function checkpoint(): string | ||
{ | ||
return $this->tableNamePrefix . '_checkpoint'; | ||
} | ||
} |
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