Skip to content

Commit

Permalink
TASK: Mark NodeTypeWithFallbackProvider as deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed May 15, 2024
1 parent 437f842 commit b02f61b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Neos.Neos/Classes/Utility/NodeTypeWithFallbackProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Neos\Neos\Utility;

use Neos\ContentRepository\Core\NodeType\NodeType;
use Neos\ContentRepository\Core\NodeType\NodeTypeManager;
use Neos\ContentRepository\Core\Projection\ContentGraph\Node;
use Neos\ContentRepository\Core\SharedModel\Exception\NodeTypeNotFound;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
Expand All @@ -13,13 +14,23 @@
/**
* Utility trait for retrieving node types for nodes with a built-in fallback mechanism
*
* This is only a temporary drop-in replacement as the automatic fallback handling
* of the NodeTypeManager was removed and Node::getNodeType was also removed.
*
* Its preferred to use the nullable {@see NodeTypeManager::getNodeType()} instead, and for cases where
* the Fallback NodeType is really required use {@see NodeTypeNameFactory::forFallback()}.
*
* @property ContentRepositoryRegistry $contentRepositoryRegistry
* @deprecated to ease migration from Neos 8.3
*/
trait NodeTypeWithFallbackProvider
{
/**
* @deprecated to ease migration from Neos 8.3
*/
protected function getNodeType(Node $node): NodeType
{
$nodeTypeManager = $this->contentRepositoryRegistry->get($node->subgraphIdentity->contentRepositoryId)->getNodeTypeManager();
$nodeTypeManager = $this->contentRepositoryRegistry->get($node->contentRepositoryId)->getNodeTypeManager();

return $nodeTypeManager->getNodeType($node->nodeTypeName)
?? $nodeTypeManager->getNodeType(NodeTypeNameFactory::forFallback())
Expand Down

0 comments on commit b02f61b

Please sign in to comment.