Skip to content

Commit

Permalink
Merge pull request neos#5226 from dlubitz/task/split-up-event-interface
Browse files Browse the repository at this point in the history
TASK: Split up EmbedsContentStreamAndNodeAggregateId interface
  • Loading branch information
mhsdesign authored Sep 16, 2024
2 parents 3044b4f + 1825895 commit f318068
Show file tree
Hide file tree
Showing 37 changed files with 377 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,16 @@

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 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 EmbedsContentStreamAndNodeAggregateId
interface EmbedsContentStreamId
{
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\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 @@ -17,7 +17,9 @@
use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePointSet;
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,7 +38,9 @@
final readonly class NodeAggregateWithNodeWasCreated implements
EventInterface,
PublishableToWorkspaceInterface,
EmbedsContentStreamAndNodeAggregateId
EmbedsContentStreamId,
EmbedsNodeAggregateId,
EmbedsWorkspaceName
{
public function __construct(
public WorkspaceName $workspaceName,
Expand All @@ -62,6 +66,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 @@ -96,8 +105,8 @@ public static function fromArray(array $values): self
: InterdimensionalSiblings::fromDimensionSpacePointSetWithSingleSucceedingSiblings(
DimensionSpacePointSet::fromArray($values['coveredDimensionSpacePoints']),
isset($values['succeedingNodeAggregateId'])
? NodeAggregateId::fromString($values['succeedingNodeAggregateId'])
: null,
? NodeAggregateId::fromString($values['succeedingNodeAggregateId'])
: null,
),
NodeAggregateId::fromString($values['parentNodeAggregateId']),
isset($values['nodeName']) ? NodeName::fromString($values['nodeName']) : null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,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,7 +34,9 @@
final readonly class NodeAggregateWasDisabled implements
EventInterface,
PublishableToWorkspaceInterface,
EmbedsContentStreamAndNodeAggregateId
EmbedsContentStreamId,
EmbedsNodeAggregateId,
EmbedsWorkspaceName
{
public function __construct(
public WorkspaceName $workspaceName,
Expand All @@ -53,6 +57,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
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePointSet;
use Neos\ContentRepository\Core\EventStore\EventInterface;
use Neos\ContentRepository\Core\EventStore\EventNormalizer;
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\SubtreeWasUntagged;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId;
Expand All @@ -33,7 +35,9 @@
final readonly class NodeAggregateWasEnabled implements
EventInterface,
PublishableToWorkspaceInterface,
EmbedsContentStreamAndNodeAggregateId
EmbedsContentStreamId,
EmbedsNodeAggregateId,
EmbedsWorkspaceName
{
public function __construct(
public WorkspaceName $workspaceName,
Expand All @@ -53,6 +57,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 f318068

Please sign in to comment.