-
-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
!!! TASK: Replace dedicated Workspace and ContentStream projections
wip
- Loading branch information
1 parent
9d14079
commit c599090
Showing
43 changed files
with
406 additions
and
358 deletions.
There are no files selected for viewing
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
54 changes: 54 additions & 0 deletions
54
Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Projection/Feature/ContentStream.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,54 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Neos\ContentGraph\DoctrineDbalAdapter\Domain\Projection\Feature; | ||
|
||
use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; | ||
use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamState; | ||
use Neos\EventStore\Model\Event\Version; | ||
|
||
/** | ||
* The ContentStream projection feature trait | ||
* | ||
* @internal | ||
*/ | ||
trait ContentStream | ||
{ | ||
private function createContentStream(ContentStreamId $contentStreamId, ContentStreamState $state, ?ContentStreamId $sourceContentStreamId = null): void | ||
{ | ||
$this->dbal->insert($this->tableNames->contentStream(), [ | ||
'contentStreamId' => $contentStreamId->value, | ||
'sourceContentStreamId' => $sourceContentStreamId?->value, | ||
'version' => 0, | ||
'state' => $state->value, | ||
]); | ||
} | ||
|
||
private function updateContentStreamState(ContentStreamId $contentStreamId, ContentStreamState $state): void | ||
{ | ||
$this->dbal->update($this->tableNames->contentStream(), [ | ||
'state' => $state->value, | ||
], [ | ||
'contentStreamId' => $contentStreamId->value | ||
]); | ||
} | ||
|
||
private function removeContentStream(ContentStreamId $contentStreamId): void | ||
{ | ||
$this->dbal->update($this->tableNames->contentStream(), [ | ||
'removed' => true, | ||
], [ | ||
'contentStreamId' => $contentStreamId->value | ||
]); | ||
} | ||
|
||
private function updateContentStreamVersion(ContentStreamId $contentStreamId, Version $version): void | ||
{ | ||
$this->dbal->update($this->tableNames->contentStream(), [ | ||
'version' => $version->value, | ||
], [ | ||
'contentStreamId' => $contentStreamId->value, | ||
]); | ||
} | ||
} |
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.