Skip to content

Commit 1930801

Browse files
authored
Merge pull request #3752 from neos/publishingBonanza
FEATURE: Refactor publication and discarding endpoints
2 parents 148a427 + 8e15504 commit 1930801

File tree

27 files changed

+825
-336
lines changed

27 files changed

+825
-336
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Neos.Neos.Ui package.
5+
*
6+
* (c) Contributors of the Neos Project - www.neos.io
7+
*
8+
* This package is Open Source Software. For the full copyright and license
9+
* information, please view the LICENSE file which was distributed with this
10+
* source code.
11+
*/
12+
13+
declare(strict_types=1);
14+
15+
namespace Neos\Neos\Ui\Application;
16+
17+
use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId;
18+
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName;
19+
use Neos\Flow\Annotations as Flow;
20+
use Neos\Neos\FrontendRouting\NodeAddress;
21+
22+
/**
23+
* The application layer level command DTO to communicate the change of the selected target workspace for publication
24+
*
25+
* @internal for communication within the Neos UI only
26+
*/
27+
#[Flow\Proxy(false)]
28+
final readonly class ChangeTargetWorkspace
29+
{
30+
public function __construct(
31+
public ContentRepositoryId $contentRepositoryId,
32+
public WorkspaceName $workspaceName,
33+
public WorkspaceName $targetWorkspaceName,
34+
public NodeAddress $documentNode
35+
) {
36+
}
37+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Neos.Neos package.
5+
*
6+
* (c) Contributors of the Neos Project - www.neos.io
7+
*
8+
* This package is Open Source Software. For the full copyright and license
9+
* information, please view the LICENSE file which was distributed with this
10+
* source code.
11+
*/
12+
13+
declare(strict_types=1);
14+
15+
namespace Neos\Neos\Ui\Application;
16+
17+
use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId;
18+
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId;
19+
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName;
20+
use Neos\Flow\Annotations as Flow;
21+
22+
/**
23+
* The application layer level command DTO to communicate discarding of all changes recorded for a given document
24+
*
25+
* @internal for communication within the Neos UI only
26+
*/
27+
#[Flow\Proxy(false)]
28+
final readonly class DiscardChangesInDocument
29+
{
30+
public function __construct(
31+
public ContentRepositoryId $contentRepositoryId,
32+
public WorkspaceName $workspaceName,
33+
public NodeAggregateId $documentId,
34+
) {
35+
}
36+
37+
/**
38+
* @param array<string,string> $values
39+
*/
40+
public static function fromArray(array $values): self
41+
{
42+
return new self(
43+
ContentRepositoryId::fromString($values['contentRepositoryId']),
44+
WorkspaceName::fromString($values['workspaceName']),
45+
NodeAggregateId::fromString($values['documentId']),
46+
);
47+
}
48+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Neos.Neos package.
5+
*
6+
* (c) Contributors of the Neos Project - www.neos.io
7+
*
8+
* This package is Open Source Software. For the full copyright and license
9+
* information, please view the LICENSE file which was distributed with this
10+
* source code.
11+
*/
12+
13+
declare(strict_types=1);
14+
15+
namespace Neos\Neos\Ui\Application;
16+
17+
use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId;
18+
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId;
19+
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName;
20+
use Neos\Flow\Annotations as Flow;
21+
22+
/**
23+
* The application layer level command DTO to communicate discarding of all changes recorded for a given site
24+
*
25+
* @internal for communication within the Neos UI only
26+
*/
27+
#[Flow\Proxy(false)]
28+
final readonly class DiscardChangesInSite
29+
{
30+
public function __construct(
31+
public ContentRepositoryId $contentRepositoryId,
32+
public WorkspaceName $workspaceName,
33+
public NodeAggregateId $siteId,
34+
) {
35+
}
36+
37+
/**
38+
* @param array<string,string> $values
39+
*/
40+
public static function fromArray(array $values): self
41+
{
42+
return new self(
43+
ContentRepositoryId::fromString($values['contentRepositoryId']),
44+
WorkspaceName::fromString($values['workspaceName']),
45+
NodeAggregateId::fromString($values['siteId']),
46+
);
47+
}
48+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Neos.Neos package.
5+
*
6+
* (c) Contributors of the Neos Project - www.neos.io
7+
*
8+
* This package is Open Source Software. For the full copyright and license
9+
* information, please view the LICENSE file which was distributed with this
10+
* source code.
11+
*/
12+
13+
declare(strict_types=1);
14+
15+
namespace Neos\Neos\Ui\Application;
16+
17+
use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId;
18+
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId;
19+
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName;
20+
use Neos\Flow\Annotations as Flow;
21+
22+
/**
23+
* The application layer level command DTO to communicate publication of all changes recorded for a given document
24+
*
25+
* @internal for communication within the Neos UI only
26+
*/
27+
#[Flow\Proxy(false)]
28+
final readonly class PublishChangesInDocument
29+
{
30+
public function __construct(
31+
public ContentRepositoryId $contentRepositoryId,
32+
public WorkspaceName $workspaceName,
33+
public NodeAggregateId $documentId,
34+
) {
35+
}
36+
37+
/**
38+
* @param array<string,string> $values
39+
*/
40+
public static function fromArray(array $values): self
41+
{
42+
return new self(
43+
ContentRepositoryId::fromString($values['contentRepositoryId']),
44+
WorkspaceName::fromString($values['workspaceName']),
45+
NodeAggregateId::fromString($values['documentId']),
46+
);
47+
}
48+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Neos.Neos.Ui package.
5+
*
6+
* (c) Contributors of the Neos Project - www.neos.io
7+
*
8+
* This package is Open Source Software. For the full copyright and license
9+
* information, please view the LICENSE file which was distributed with this
10+
* source code.
11+
*/
12+
13+
declare(strict_types=1);
14+
15+
namespace Neos\Neos\Ui\Application;
16+
17+
use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId;
18+
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId;
19+
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName;
20+
use Neos\Flow\Annotations as Flow;
21+
22+
/**
23+
* The application layer level command DTO to communicate publication of all changes recorded for a given site
24+
*
25+
* @internal for communication within the Neos UI only
26+
*/
27+
#[Flow\Proxy(false)]
28+
final readonly class PublishChangesInSite
29+
{
30+
public function __construct(
31+
public ContentRepositoryId $contentRepositoryId,
32+
public WorkspaceName $workspaceName,
33+
public NodeAggregateId $siteId,
34+
) {
35+
}
36+
37+
/**
38+
* @param array<string,string> $values
39+
*/
40+
public static function fromArray(array $values): self
41+
{
42+
return new self(
43+
ContentRepositoryId::fromString($values['contentRepositoryId']),
44+
WorkspaceName::fromString($values['workspaceName']),
45+
NodeAggregateId::fromString($values['siteId']),
46+
);
47+
}
48+
}

Classes/Application/SyncWorkspace.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Neos.Neos.Ui package.
5+
*
6+
* (c) Contributors of the Neos Project - www.neos.io
7+
*
8+
* This package is Open Source Software. For the full copyright and license
9+
* information, please view the LICENSE file which was distributed with this
10+
* source code.
11+
*/
12+
13+
declare(strict_types=1);
14+
15+
namespace Neos\Neos\Ui\Application;
16+
17+
use Neos\ContentRepository\Core\Feature\WorkspaceRebase\Dto\RebaseErrorHandlingStrategy;
18+
use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId;
19+
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName;
20+
use Neos\Flow\Annotations as Flow;
21+
22+
/**
23+
* The application layer level command DTO to communicate the intent to rebase the workspace
24+
*
25+
* @internal for communication within the Neos UI only
26+
*/
27+
#[Flow\Proxy(false)]
28+
final readonly class SyncWorkspace
29+
{
30+
public function __construct(
31+
public ContentRepositoryId $contentRepositoryId,
32+
public WorkspaceName $workspaceName,
33+
public RebaseErrorHandlingStrategy $rebaseErrorHandlingStrategy
34+
) {
35+
}
36+
}

Classes/ContentRepository/Service/NeosUiNodeService.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints;
1919
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
2020
use Neos\Flow\Annotations as Flow;
21+
use Neos\Neos\FrontendRouting\NodeAddress;
2122
use Neos\Neos\Utility\NodeTypeWithFallbackProvider;
2223

2324
/**
@@ -43,4 +44,10 @@ public function findNodeBySerializedNodeAddress(string $serializedNodeAddress, C
4344
);
4445
return $subgraph->findNodeById($nodeAddress->nodeAggregateId);
4546
}
47+
48+
public function deserializeNodeAddress(string $serializedNodeAddress, ContentRepositoryId $contentRepositoryId): NodeAddress
49+
{
50+
$contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId);
51+
return NodeAddressFactory::create($contentRepository)->createFromUriString($serializedNodeAddress);
52+
}
4653
}

0 commit comments

Comments
 (0)