-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #116 from neos/feature/create-content-context-trait
FEATURE: Remove CreateContentContextTrait and add todos
- Loading branch information
Showing
4 changed files
with
94 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/ContentRepository90/Legacy/CreateContentContextTrait.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
namespace Neos\Neos\Controller; | ||
|
||
use Neos\Flow\Annotations as Flow; | ||
use Neos\Neos\Domain\Service\ContentContext; | ||
use Neos\ContentRepository\Domain\Model\NodeData; | ||
|
||
/** | ||
* @deprecated | ||
*/ | ||
trait CreateContentContextTrait | ||
{ | ||
protected function createContentContext($workspaceName, array $dimensions = []): ContentContext | ||
{ | ||
return new ContentContext($workspaceName, $dimensions); | ||
} | ||
|
||
protected function createContextMatchingNodeData(NodeData $nodeData): ContentContext | ||
{ | ||
return new ContentContext(); | ||
|
||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
tests/Sets/ContentRepository90/Fixture/Context/create-content-context.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
namespace Neos\Rector\Test; | ||
|
||
use Neos\ContentRepository\Domain\Model\NodeData; | ||
use Neos\Neos\Controller\CreateContentContextTrait; | ||
|
||
class CreateContentContextClassTest extends AnotherClass | ||
{ | ||
use CreateContentContextTrait; | ||
|
||
public function foo() { | ||
$workspaceName = "workspacename"; | ||
$dimensions = []; | ||
$context = $this->createContentContext($workspaceName, $dimensions); | ||
$context->getCurrentSite(); | ||
} | ||
|
||
public function bar(NodeData $nodeData) | ||
{ | ||
$context = $this->createContextMatchingNodeData($nodeData); | ||
$context->getCurrentSite(); | ||
} | ||
} | ||
|
||
----- | ||
<?php | ||
|
||
namespace Neos\Rector\Test; | ||
|
||
use Neos\ContentRepository\Domain\Model\NodeData; | ||
use Neos\Neos\Controller\CreateContentContextTrait; | ||
|
||
class CreateContentContextClassTest extends AnotherClass | ||
{ | ||
public function foo() { | ||
$workspaceName = "workspacename"; | ||
$dimensions = []; | ||
// TODO 9.0 migration: !! CreateContentContextTrait::createContentContext() is removed in Neos 9.0. | ||
|
||
$context = $this->createContentContext($workspaceName, $dimensions); | ||
// TODO 9.0 migration: !! ContentContext::getCurrentSite() is removed in Neos 9.0. | ||
|
||
$context->getCurrentSite(); | ||
} | ||
|
||
public function bar(NodeData $nodeData) | ||
{ | ||
// TODO 9.0 migration: !! CreateContentContextTrait::createContextMatchingNodeData() is removed in Neos 9.0. | ||
|
||
$context = $this->createContextMatchingNodeData($nodeData); | ||
// TODO 9.0 migration: !! ContentContext::getCurrentSite() is removed in Neos 9.0. | ||
|
||
$context->getCurrentSite(); | ||
} | ||
} | ||
|