Skip to content

Commit 5c344cb

Browse files
committed
Merge remote-tracking branch 'origin/9.0' into task/90-remove-nodetypemanager-from-node-4515
2 parents 661a1e0 + adc3a9a commit 5c344cb

File tree

60 files changed

+232
-180
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+232
-180
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ jobs:
100100
./flow flow:cache:flush
101101
./flow flow:cache:warmup
102102
./flow doctrine:migrate
103-
./flow user:create --username=admin --password=password --first-name=John --last-name=Doe --roles=Administrator
103+
./flow user:create --username=admin --password=admin --first-name=John --last-name=Doe --roles=Administrator
104104
- run:
105105
name: Start flow server
106106
command: /home/circleci/app/flow server:run --port 8081

Classes/ContentRepository/Service/NodeService.php

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

2223
/**
2324
* @Flow\Scope("singleton")
2425
*/
2526
class NodeService
2627
{
27-
/**
28-
* @Flow\Inject
29-
* @var ContentRepositoryRegistry
30-
*/
31-
protected $contentRepositoryRegistry;
28+
use NodeTypeWithFallbackProvider;
29+
30+
#[Flow\Inject]
31+
protected ContentRepositoryRegistry $contentRepositoryRegistry;
3232

3333
/**
3434
* Helper method to retrieve the closest document for a node
3535
*/
3636
public function getClosestDocument(Node $node): ?Node
3737
{
38-
if ($node->nodeType->isOfType('Neos.Neos:Document')) {
38+
if ($this->getNodeType($node)->isOfType('Neos.Neos:Document')) {
3939
return $node;
4040
}
4141

4242
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);
4343

4444
while ($node instanceof Node) {
45-
if ($node->nodeType->isOfType('Neos.Neos:Document')) {
45+
if ($this->getNodeType($node)->isOfType('Neos.Neos:Document')) {
4646
return $node;
4747
}
4848
$node = $subgraph->findParentNode($node->nodeAggregateId);

Classes/ContentRepository/Service/WorkspaceService.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,18 @@
2626
use Neos\Neos\PendingChangesProjection\ChangeFinder;
2727
use Neos\Neos\Service\UserService;
2828
use Neos\Neos\Ui\Domain\Model\Feedback\Operations\RemoveNode;
29+
use Neos\Neos\Utility\NodeTypeWithFallbackProvider;
2930

3031
/**
3132
* @Flow\Scope("singleton")
3233
*/
3334
class WorkspaceService
3435
{
36+
use NodeTypeWithFallbackProvider;
37+
38+
#[Flow\Inject]
39+
protected ContentRepositoryRegistry $contentRepositoryRegistry;
40+
3541
/**
3642
* @Flow\Inject
3743
* @var UserService
@@ -44,12 +50,6 @@ class WorkspaceService
4450
*/
4551
protected $domainUserService;
4652

47-
/**
48-
* @Flow\Inject
49-
* @var ContentRepositoryRegistry
50-
*/
51-
protected $contentRepositoryRegistry;
52-
5353
/**
5454
* Get all publishable node context paths for a workspace
5555
*
@@ -207,7 +207,7 @@ private function getClosestDocumentNode(Node $node): ?Node
207207
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);
208208

209209
while ($node instanceof Node) {
210-
if ($node->nodeType->isOfType('Neos.Neos:Document')) {
210+
if ($this->getNodeType($node)->isOfType('Neos.Neos:Document')) {
211211
return $node;
212212
}
213213
$node = $subgraph->findParentNode($node->nodeAggregateId);

Classes/Controller/BackendController.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,24 @@
1313
*/
1414

1515
use Neos\ContentRepository\Core\NodeType\NodeTypeName;
16-
use Neos\Neos\FrontendRouting\NodeAddressFactory;
1716
use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints;
1817
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
19-
use Neos\Neos\Domain\Model\WorkspaceName as NeosWorkspaceName;
2018
use Neos\Flow\Annotations as Flow;
2119
use Neos\Flow\Mvc\Controller\ActionController;
20+
use Neos\Flow\Mvc\View\ViewInterface;
21+
use Neos\Flow\Persistence\PersistenceManagerInterface;
2222
use Neos\Flow\ResourceManagement\ResourceManager;
2323
use Neos\Flow\Security\Context;
2424
use Neos\Flow\Session\SessionInterface;
25+
use Neos\Fusion\View\FusionView;
2526
use Neos\Neos\Controller\Backend\MenuHelper;
2627
use Neos\Neos\Domain\Repository\DomainRepository;
2728
use Neos\Neos\Domain\Repository\SiteRepository;
29+
use Neos\Neos\Domain\Service\WorkspaceNameBuilder;
30+
use Neos\Neos\FrontendRouting\NodeAddressFactory;
2831
use Neos\Neos\FrontendRouting\SiteDetection\SiteDetectionResult;
2932
use Neos\Neos\Service\BackendRedirectionService;
3033
use Neos\Neos\Service\UserService;
31-
use Neos\Flow\Persistence\PersistenceManagerInterface;
32-
use Neos\Fusion\View\FusionView;
33-
use Neos\Flow\Mvc\View\ViewInterface;
3434
use Neos\Neos\Ui\Domain\Service\StyleAndJavascriptInclusionService;
3535
use Neos\Neos\Ui\Service\NodeClipboard;
3636

@@ -148,8 +148,7 @@ public function indexAction(string $node = null)
148148

149149
$currentAccount = $this->securityContext->getAccount();
150150
$workspace = $contentRepository->getWorkspaceFinder()->findOneByName(
151-
NeosWorkspaceName::fromAccountIdentifier($currentAccount->getAccountIdentifier())
152-
->toContentRepositoryWorkspaceName()
151+
WorkspaceNameBuilder::fromAccountIdentifier($currentAccount->getAccountIdentifier())
153152
);
154153
if (is_null($workspace)) {
155154
$this->redirectToUri($this->uriBuilder->uriFor('index', [], 'Login', 'Neos.Neos'));

Classes/Controller/BackendServiceController.php

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@
1313
* source code.
1414
*/
1515

16+
use Neos\ContentRepository\Core\Feature\WorkspaceModification\Command\ChangeBaseWorkspace;
17+
use Neos\ContentRepository\Core\Feature\WorkspaceModification\Exception\WorkspaceIsNotEmptyException;
1618
use Neos\ContentRepository\Core\Feature\WorkspacePublication\Command\DiscardIndividualNodesFromWorkspace;
1719
use Neos\ContentRepository\Core\Feature\WorkspacePublication\Command\PublishIndividualNodesFromWorkspace;
1820
use Neos\ContentRepository\Core\Feature\WorkspacePublication\Dto\NodeIdsToPublishOrDiscard;
1921
use Neos\ContentRepository\Core\Feature\WorkspacePublication\Dto\NodeIdToPublishOrDiscard;
2022
use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints;
2123
use Neos\ContentRepository\Core\SharedModel\Exception\NodeAggregateCurrentlyDoesNotExist;
24+
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName;
2225
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
2326
use Neos\Eel\FlowQuery\FlowQuery;
2427
use Neos\Flow\Annotations as Flow;
@@ -29,7 +32,7 @@
2932
use Neos\Flow\Persistence\PersistenceManagerInterface;
3033
use Neos\Flow\Property\PropertyMapper;
3134
use Neos\Flow\Security\Context;
32-
use Neos\Neos\Domain\Model\WorkspaceName as NeosWorkspaceName;
35+
use Neos\Neos\Domain\Service\WorkspaceNameBuilder;
3336
use Neos\Neos\FrontendRouting\NodeAddress;
3437
use Neos\Neos\FrontendRouting\NodeAddressFactory;
3538
use Neos\Neos\FrontendRouting\SiteDetection\SiteDetectionResult;
@@ -40,6 +43,8 @@
4043
use Neos\Neos\Ui\Domain\Model\Feedback\Messages\Error;
4144
use Neos\Neos\Ui\Domain\Model\Feedback\Messages\Info;
4245
use Neos\Neos\Ui\Domain\Model\Feedback\Messages\Success;
46+
use Neos\Neos\Ui\Domain\Model\Feedback\Operations\Redirect;
47+
use Neos\Neos\Ui\Domain\Model\Feedback\Operations\ReloadDocument;
4348
use Neos\Neos\Ui\Domain\Model\Feedback\Operations\UpdateWorkspaceInfo;
4449
use Neos\Neos\Ui\Domain\Model\FeedbackCollection;
4550
use Neos\Neos\Ui\Domain\Service\NodeTreeBuilder;
@@ -50,12 +55,6 @@
5055
use Neos\Neos\Ui\Service\PublishingService;
5156
use Neos\Neos\Ui\TypeConverter\ChangeCollectionConverter;
5257
use Neos\Neos\Utility\NodeUriPathSegmentGenerator;
53-
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName;
54-
use Neos\ContentRepository\Core\Feature\WorkspaceModification\Command\ChangeBaseWorkspace;
55-
use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId;
56-
use Neos\Neos\Ui\Domain\Model\Feedback\Operations\ReloadDocument;
57-
use Neos\Neos\Ui\Domain\Model\Feedback\Operations\Redirect;
58-
use Neos\ContentRepository\Core\Feature\WorkspaceModification\Exception\WorkspaceIsNotEmptyException;
5958

6059
class BackendServiceController extends ActionController
6160
{
@@ -195,8 +194,7 @@ public function publishAllAction(): void
195194
$contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId);
196195

197196
$currentAccount = $this->securityContext->getAccount();
198-
$workspaceName = NeosWorkspaceName::fromAccountIdentifier($currentAccount->getAccountIdentifier())
199-
->toContentRepositoryWorkspaceName();
197+
$workspaceName = WorkspaceNameBuilder::fromAccountIdentifier($currentAccount->getAccountIdentifier());
200198
$this->publishingService->publishWorkspace($contentRepository, $workspaceName);
201199

202200
$success = new Success();
@@ -222,8 +220,7 @@ public function publishAction(array $nodeContextPaths, string $targetWorkspaceNa
222220

223221
try {
224222
$currentAccount = $this->securityContext->getAccount();
225-
$workspaceName = NeosWorkspaceName::fromAccountIdentifier($currentAccount->getAccountIdentifier())
226-
->toContentRepositoryWorkspaceName();
223+
$workspaceName = WorkspaceNameBuilder::fromAccountIdentifier($currentAccount->getAccountIdentifier());
227224

228225
$nodeIdentifiersToPublish = [];
229226
foreach ($nodeContextPaths as $contextPath) {
@@ -282,8 +279,7 @@ public function discardAction(array $nodeContextPaths): void
282279

283280
try {
284281
$currentAccount = $this->securityContext->getAccount();
285-
$workspaceName = NeosWorkspaceName::fromAccountIdentifier($currentAccount->getAccountIdentifier())
286-
->toContentRepositoryWorkspaceName();
282+
$workspaceName = WorkspaceNameBuilder::fromAccountIdentifier($currentAccount->getAccountIdentifier());
287283

288284
$nodeIdentifiersToDiscard = [];
289285
foreach ($nodeContextPaths as $contextPath) {
@@ -343,9 +339,9 @@ public function changeBaseWorkspaceAction(string $targetWorkspaceName, string $d
343339
$nodeAddress = $nodeAddressFactory->createFromUriString($documentNode);
344340

345341
$currentAccount = $this->securityContext->getAccount();
346-
$userWorkspaceName = NeosWorkspaceName::fromAccountIdentifier(
342+
$userWorkspaceName = WorkspaceNameBuilder::fromAccountIdentifier(
347343
$currentAccount->getAccountIdentifier()
348-
)->toContentRepositoryWorkspaceName();
344+
);
349345

350346
$command = ChangeBaseWorkspace::create($userWorkspaceName, WorkspaceName::fromString($targetWorkspaceName));
351347
try {

Classes/Domain/Model/AbstractChange.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,17 @@
1919
use Neos\Neos\Ui\Domain\Model\Feedback\Operations\NodeCreated;
2020
use Neos\Neos\Ui\Domain\Model\Feedback\Operations\ReloadDocument;
2121
use Neos\Neos\Ui\Domain\Model\Feedback\Operations\UpdateWorkspaceInfo;
22+
use Neos\Neos\Utility\NodeTypeWithFallbackProvider;
2223

2324
abstract class AbstractChange implements ChangeInterface
2425
{
26+
use NodeTypeWithFallbackProvider;
27+
2528
protected ?Node $subject;
2629

30+
#[Flow\Inject]
31+
protected ContentRepositoryRegistry $contentRepositoryRegistry;
32+
2733
/**
2834
* @Flow\Inject
2935
* @var FeedbackCollection
@@ -42,12 +48,6 @@ abstract class AbstractChange implements ChangeInterface
4248
*/
4349
protected $persistenceManager;
4450

45-
/**
46-
* @Flow\Inject
47-
* @var ContentRepositoryRegistry
48-
*/
49-
protected $contentRepositoryRegistry;
50-
5151
public function setSubject(Node $subject): void
5252
{
5353
$this->subject = $subject;
@@ -81,7 +81,7 @@ protected function updateWorkspaceInfo(): void
8181
final protected function findClosestDocumentNode(Node $node): ?Node
8282
{
8383
while ($node instanceof Node) {
84-
if ($node->nodeType->isOfType('Neos.Neos:Document')) {
84+
if ($this->getNodeType($node)->isOfType('Neos.Neos:Document')) {
8585
return $node;
8686
}
8787
$node = $this->findParentNode($node);

Classes/Domain/Model/Changes/AbstractCreate.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ protected function createNode(
9797
if (is_null($nodeTypeName)) {
9898
throw new \RuntimeException('Cannot run createNode without a set node type.', 1645577794);
9999
}
100-
// TODO: the $name=... line should be as expressed below
101-
// $name = $this->getName() ?: $this->nodeService->generateUniqueNodeName($parent->findParentNode());
102-
$nodeName = NodeName::fromString($this->getName() ?: uniqid('node-', false));
100+
$nodeName = $this->getName()
101+
? NodeName::fromString($this->getName())
102+
: null;
103103

104104
$nodeAggregateId = NodeAggregateId::create(); // generate a new NodeAggregateId
105105

Classes/Domain/Model/Changes/AbstractStructuralChange.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindChildNodesFilter;
1616
use Neos\ContentRepository\Core\Projection\ContentGraph\Node;
1717
use Neos\ContentRepository\Core\NodeType\NodeType;
18+
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateClassification;
1819
use Neos\Neos\FrontendRouting\NodeAddressFactory;
1920
use Neos\ContentRepository\Core\Projection\ContentGraph\Nodes;
2021
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
@@ -25,13 +26,18 @@
2526
use Neos\Neos\Ui\Domain\Model\Feedback\Operations\RenderContentOutOfBand;
2627
use Neos\Neos\Ui\Domain\Model\Feedback\Operations\UpdateNodeInfo;
2728
use Neos\Neos\Ui\Domain\Model\RenderedNodeDomAddress;
28-
use Neos\Neos\Ui\Fusion\Helper\NodeInfoHelper;
29+
use Neos\Neos\Utility\NodeTypeWithFallbackProvider;
2930

3031
/**
3132
* A change that performs structural actions like moving or creating nodes
3233
*/
3334
abstract class AbstractStructuralChange extends AbstractChange
3435
{
36+
use NodeTypeWithFallbackProvider;
37+
38+
#[Flow\Inject]
39+
protected ContentRepositoryRegistry $contentRepositoryRegistry;
40+
3541
/**
3642
* The node dom address for the parent node of the created node
3743
*/
@@ -48,12 +54,6 @@ abstract class AbstractStructuralChange extends AbstractChange
4854
*/
4955
protected $nodeService;
5056

51-
/**
52-
* @Flow\Inject
53-
* @var ContentRepositoryRegistry
54-
*/
55-
protected $contentRepositoryRegistry;
56-
5757
protected ?Node $cachedSiblingNode = null;
5858

5959
/**
@@ -146,14 +146,14 @@ protected function finish(Node $node)
146146

147147
$this->updateWorkspaceInfo();
148148

149-
if ($node->nodeType->isOfType('Neos.Neos:Content')
149+
if ($this->getNodeType($node)->isOfType('Neos.Neos:Content')
150150
&& ($this->getParentDomAddress() || $this->getSiblingDomAddress())) {
151151
// we can ONLY render out of band if:
152152
// 1) the parent of our new (or copied or moved) node is a ContentCollection;
153153
// so we can directly update an element of this content collection
154154

155155
$contentRepository = $this->contentRepositoryRegistry->get($parentNode->subgraphIdentity->contentRepositoryId);
156-
if ($parentNode && $parentNode->nodeType->isOfType('Neos.Neos:ContentCollection') &&
156+
if ($parentNode && $this->getNodeType($parentNode)->isOfType('Neos.Neos:ContentCollection') &&
157157
// 2) the parent DOM address (i.e. the closest RENDERED node in DOM is actually the ContentCollection;
158158
// and no other node in between
159159
$this->getParentDomAddress() &&
@@ -186,16 +186,16 @@ protected function findChildNodes(Node $node): Nodes
186186

187187
protected function isNodeTypeAllowedAsChildNode(Node $node, NodeType $nodeType): bool
188188
{
189-
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);
190-
$contentRepository = $this->contentRepositoryRegistry->get($node->subgraphIdentity->contentRepositoryId);
191-
$nodeTypeManager = $contentRepository->getNodeTypeManager();
192-
if (!$node->classification->isTethered()) {
193-
return $node->nodeType->allowsChildNodeType($nodeType);
189+
if ($node->classification !== NodeAggregateClassification::CLASSIFICATION_TETHERED) {
190+
return $this->getNodeType($node)->allowsChildNodeType($nodeType);
194191
}
195192

193+
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);
196194
$parentNode = $subgraph->findParentNode($node->nodeAggregateId);
197-
return !$parentNode || $nodeTypeManager->allowsGrandchildNodeType(
198-
$parentNode->nodeType,
195+
$nodeTypeManager = $this->contentRepositoryRegistry->get($node->subgraphIdentity->contentRepositoryId)->getNodeTypeManager();
196+
197+
return !$parentNode || $nodeTypeManager->isNodeTypeAllowedAsChildToTetheredNode(
198+
$this->getNodeType($parentNode),
199199
$node->nodeName,
200200
$nodeType
201201
);

0 commit comments

Comments
 (0)