Skip to content

Commit

Permalink
TASK: Split up EmbedsContentStreamAndNodeAggregateId interface into E…
Browse files Browse the repository at this point in the history
…mbedsContentStreamId and EmbedsNodeAggregateId and add EmbedsWorkspaceName interface
  • Loading branch information
dlubitz committed Aug 28, 2024
1 parent d7b4ce5 commit d38fd9d
Show file tree
Hide file tree
Showing 38 changed files with 410 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,14 @@

namespace Neos\ContentRepository\Core\Feature\Common;

use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId;
use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId;

/**
* This interface is implemented by **events** which contain ContentStreamId and NodeAggregateId.
*
* This is relevant e.g. for content cache flushing as a result of an event.
*
* @internal
* @deprecated Use {@see EmbedsContentStreamId} and/or {@see EmbedsNodeAggregateId} instead. Will be removed with Neos 10.
*/
interface EmbedsContentStreamAndNodeAggregateId
interface EmbedsContentStreamAndNodeAggregateId extends EmbedsContentStreamId, EmbedsNodeAggregateId
{
public function getContentStreamId(): ContentStreamId;
public function getNodeAggregateId(): NodeAggregateId;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

/*
* This file is part of the Neos.ContentRepository package.
*
* (c) Contributors of the Neos Project - www.neos.io
*
* This package is Open Source Software. For the full copyright and license
* information, please view the LICENSE file which was distributed with this
* source code.
*/

declare(strict_types=1);

namespace Neos\ContentRepository\Core\Feature\Common;

use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId;

/**
* This interface is implemented by **events** which contain ContentStreamId.
*
* This is relevant e.g. for content cache flushing as a result of an event.
*
* @internal
*/
interface EmbedsContentStreamId
{
public function getContentStreamId(): ContentStreamId;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

/*
* This file is part of the Neos.ContentRepository package.
*
* (c) Contributors of the Neos Project - www.neos.io
*
* This package is Open Source Software. For the full copyright and license
* information, please view the LICENSE file which was distributed with this
* source code.
*/

declare(strict_types=1);

namespace Neos\ContentRepository\Core\Feature\Common;

use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId;

/**
* This interface is implemented by **events** which contain NodeAggregateId.
*
* This is relevant e.g. for content cache flushing as a result of an event.
*
* @internal
*/
interface EmbedsNodeAggregateId
{
public function getNodeAggregateId(): NodeAggregateId;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

/*
* This file is part of the Neos.ContentRepository package.
*
* (c) Contributors of the Neos Project - www.neos.io
*
* This package is Open Source Software. For the full copyright and license
* information, please view the LICENSE file which was distributed with this
* source code.
*/

declare(strict_types=1);

namespace Neos\ContentRepository\Core\Feature\Common;

use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName;

/**
* This interface is implemented by **events** which contain WorkspaceName.
*
* This is relevant e.g. for content cache flushing as a result of an event.
*
* @internal
*/
interface EmbedsWorkspaceName
{
public function getWorkspaceName(): WorkspaceName;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,24 @@
*/

use Neos\ContentRepository\Core\EventStore\EventInterface;
use Neos\ContentRepository\Core\Feature\Common\EmbedsContentStreamId;
use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId;

/**
* @api events are the persistence-API of the content repository
*/
final readonly class ContentStreamWasClosed implements EventInterface
final readonly class ContentStreamWasClosed implements EventInterface, EmbedsContentStreamId
{
public function __construct(
public ContentStreamId $contentStreamId,
) {
}

public function getContentStreamId(): ContentStreamId
{
return $this->contentStreamId;
}

public static function fromArray(array $values): self
{
return new self(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,26 @@
namespace Neos\ContentRepository\Core\Feature\ContentStreamClosing\Event;

use Neos\ContentRepository\Core\EventStore\EventInterface;
use Neos\ContentRepository\Core\Feature\Common\EmbedsContentStreamId;
use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId;
use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamState;

/**
* @api events are the persistence-API of the content repository
*/
final readonly class ContentStreamWasReopened implements EventInterface
final readonly class ContentStreamWasReopened implements EventInterface, EmbedsContentStreamId
{
public function __construct(
public ContentStreamId $contentStreamId,
public ContentStreamState $previousState,
) {
}

public function getContentStreamId(): ContentStreamId
{
return $this->contentStreamId;
}

public static function fromArray(array $values): self
{
return new self(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
namespace Neos\ContentRepository\Core\Feature\ContentStreamCreation\Event;

use Neos\ContentRepository\Core\EventStore\EventInterface;
use Neos\ContentRepository\Core\Feature\Common\EmbedsContentStreamId;
use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId;

/**
Expand All @@ -23,13 +24,18 @@
*
* @api events are the persistence-API of the content repository
*/
final readonly class ContentStreamWasCreated implements EventInterface
final readonly class ContentStreamWasCreated implements EventInterface, EmbedsContentStreamId
{
public function __construct(
public ContentStreamId $contentStreamId,
) {
}

public function getContentStreamId(): ContentStreamId
{
return $this->contentStreamId;
}

public static function fromArray(array $values): self
{
return new self(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,24 @@
*/

use Neos\ContentRepository\Core\EventStore\EventInterface;
use Neos\ContentRepository\Core\Feature\Common\EmbedsContentStreamId;
use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId;

/**
* @api events are the persistence-API of the content repository
*/
final readonly class ContentStreamWasRemoved implements EventInterface
final readonly class ContentStreamWasRemoved implements EventInterface, EmbedsContentStreamId
{
public function __construct(
public ContentStreamId $contentStreamId,
) {
}

public function getContentStreamId(): ContentStreamId
{
return $this->contentStreamId;
}

public static function fromArray(array $values): self
{
return new self(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint;
use Neos\ContentRepository\Core\EventStore\EventInterface;
use Neos\ContentRepository\Core\Feature\Common\EmbedsContentStreamId;
use Neos\ContentRepository\Core\Feature\Common\EmbedsWorkspaceName;
use Neos\ContentRepository\Core\Feature\Common\PublishableToWorkspaceInterface;
use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId;
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName;
Expand All @@ -33,7 +35,7 @@
*
* @api events are the persistence-API of the content repository
*/
final readonly class DimensionShineThroughWasAdded implements EventInterface, PublishableToWorkspaceInterface
final readonly class DimensionShineThroughWasAdded implements EventInterface, PublishableToWorkspaceInterface, EmbedsContentStreamId, EmbedsWorkspaceName
{
public function __construct(
public WorkspaceName $workspaceName,
Expand All @@ -43,6 +45,16 @@ public function __construct(
) {
}

public function getContentStreamId(): ContentStreamId
{
return $this->contentStreamId;
}

public function getWorkspaceName(): WorkspaceName
{
return $this->workspaceName;
}

public function withWorkspaceNameAndContentStreamId(WorkspaceName $targetWorkspaceName, ContentStreamId $contentStreamId): self
{
return new self(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint;
use Neos\ContentRepository\Core\EventStore\EventInterface;
use Neos\ContentRepository\Core\Feature\Common\EmbedsContentStreamId;
use Neos\ContentRepository\Core\Feature\Common\EmbedsWorkspaceName;
use Neos\ContentRepository\Core\Feature\Common\PublishableToWorkspaceInterface;
use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId;
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName;
Expand All @@ -29,7 +31,7 @@
*
* @api events are the persistence-API of the content repository
*/
final readonly class DimensionSpacePointWasMoved implements EventInterface, PublishableToWorkspaceInterface
final readonly class DimensionSpacePointWasMoved implements EventInterface, PublishableToWorkspaceInterface, EmbedsContentStreamId, EmbedsWorkspaceName
{
public function __construct(
public WorkspaceName $workspaceName,
Expand All @@ -39,6 +41,16 @@ public function __construct(
) {
}

public function getContentStreamId(): ContentStreamId
{
return $this->contentStreamId;
}

public function getWorkspaceName(): WorkspaceName
{
return $this->workspaceName;
}

public function withWorkspaceNameAndContentStreamId(WorkspaceName $targetWorkspaceName, ContentStreamId $contentStreamId): self
{
return new self(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
use Neos\ContentRepository\Core\DimensionSpace\OriginDimensionSpacePoint;
use Neos\ContentRepository\Core\EventStore\EventInterface;
use Neos\ContentRepository\Core\Feature\Common\EmbedsContentStreamAndNodeAggregateId;
use Neos\ContentRepository\Core\Feature\Common\EmbedsContentStreamId;
use Neos\ContentRepository\Core\Feature\Common\EmbedsNodeAggregateId;
use Neos\ContentRepository\Core\Feature\Common\EmbedsWorkspaceName;
use Neos\ContentRepository\Core\Feature\Common\InterdimensionalSiblings;
use Neos\ContentRepository\Core\Feature\Common\PublishableToWorkspaceInterface;
use Neos\ContentRepository\Core\Feature\NodeModification\Dto\SerializedPropertyValues;
Expand All @@ -36,6 +39,9 @@
final readonly class NodeAggregateWithNodeWasCreated implements
EventInterface,
PublishableToWorkspaceInterface,
EmbedsContentStreamId,
EmbedsNodeAggregateId,
EmbedsWorkspaceName,
EmbedsContentStreamAndNodeAggregateId
{
public function __construct(
Expand All @@ -62,6 +68,11 @@ public function getNodeAggregateId(): NodeAggregateId
return $this->nodeAggregateId;
}

public function getWorkspaceName(): WorkspaceName
{
return $this->workspaceName;
}

public function getOriginDimensionSpacePoint(): OriginDimensionSpacePoint
{
return $this->originDimensionSpacePoint;
Expand Down Expand Up @@ -94,11 +105,11 @@ public static function fromArray(array $values): self
array_key_exists('succeedingSiblingsForCoverage', $values)
? InterdimensionalSiblings::fromArray($values['succeedingSiblingsForCoverage'])
: InterdimensionalSiblings::fromDimensionSpacePointSetWithSingleSucceedingSiblings(
DimensionSpacePointSet::fromArray($values['coveredDimensionSpacePoints']),
isset($values['succeedingNodeAggregateId'])
? NodeAggregateId::fromString($values['succeedingNodeAggregateId'])
: null,
),
DimensionSpacePointSet::fromArray($values['coveredDimensionSpacePoints']),
isset($values['succeedingNodeAggregateId'])
? NodeAggregateId::fromString($values['succeedingNodeAggregateId'])
: null,
),
NodeAggregateId::fromString($values['parentNodeAggregateId']),
isset($values['nodeName']) ? NodeName::fromString($values['nodeName']) : null,
SerializedPropertyValues::fromArray($values['initialPropertyValues']),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePointSet;
use Neos\ContentRepository\Core\EventStore\EventInterface;
use Neos\ContentRepository\Core\Feature\Common\EmbedsContentStreamAndNodeAggregateId;
use Neos\ContentRepository\Core\Feature\Common\EmbedsContentStreamId;
use Neos\ContentRepository\Core\Feature\Common\EmbedsNodeAggregateId;
use Neos\ContentRepository\Core\Feature\Common\EmbedsWorkspaceName;
use Neos\ContentRepository\Core\Feature\Common\PublishableToWorkspaceInterface;
use Neos\ContentRepository\Core\Feature\SubtreeTagging\Event\SubtreeWasTagged;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId;
Expand All @@ -32,6 +35,9 @@
final readonly class NodeAggregateWasDisabled implements
EventInterface,
PublishableToWorkspaceInterface,
EmbedsContentStreamId,
EmbedsNodeAggregateId,
EmbedsWorkspaceName,
EmbedsContentStreamAndNodeAggregateId
{
public function __construct(
Expand All @@ -53,6 +59,11 @@ public function getNodeAggregateId(): NodeAggregateId
return $this->nodeAggregateId;
}

public function getWorkspaceName(): WorkspaceName
{
return $this->workspaceName;
}

public function withWorkspaceNameAndContentStreamId(WorkspaceName $targetWorkspaceName, ContentStreamId $contentStreamId): self
{
return new self(
Expand Down
Loading

0 comments on commit d38fd9d

Please sign in to comment.