Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TASK Refactor ContentContext methods #36

Merged
merged 5 commits into from
Nov 2, 2023
Merged

Conversation

dlubitz
Copy link
Contributor

@dlubitz dlubitz commented Oct 27, 2023

This rector replaces removed ContentContext calls in PHP and Fusion. For better detection of context objects all Node(Interface)s get replaced by Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub. The Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub get replaced at the end by Neos\ContentRepository\Core\Projection\ContentGraph\Node

PHP

  • ContentContext::isInBackend => $this->renderingModeService->findByCurrentUser()->isEdit
  • ContentContext::isLive => !$this->renderingModeService->findByCurrentUser()->isEdit && !$this->renderingModeService->findByCurrentUser()->isPreview
  • ContentContext::getCurrentRenderingMode => $this->renderingModeService->findByCurrentUser()
  • ContentContext::getCurrentSiteNode => Warning, no replacement
  • ContentContext::getCurrentDomain => Warning, no replacement
  • ContentContext::getCurrentSite => Warning, no replacement

Fusion

  • node.context.currentDomain => Warning, no replacement
  • context.currentSiteNode => Warning, no replacement

Fixes #31

@dlubitz dlubitz changed the title TASK Refector context methods WIP TASK Refector context methods Oct 27, 2023
@dlubitz dlubitz force-pushed the task/context-methods branch from 70bd4c5 to 236e661 Compare November 1, 2023 19:23
@dlubitz dlubitz force-pushed the task/context-methods branch from de418d4 to 6425df9 Compare November 1, 2023 19:54
@dlubitz dlubitz self-assigned this Nov 1, 2023
@dlubitz dlubitz marked this pull request as ready for review November 1, 2023 20:08
@dlubitz dlubitz changed the title WIP TASK Refector context methods TASK Refector context methods Nov 1, 2023
@dlubitz dlubitz changed the title TASK Refector context methods TASK Refactor context methods Nov 1, 2023
@@ -275,23 +279,22 @@
* ContentContext
*/
// ContentContext::getCurrentSite
// TODO: PHP
$methodCallToWarningComments[] = new MethodCallToWarningComment(LegacyContextStub::class, 'getCurrentSite', '!! ContentContext::getCurrentSite() is removed in Neos 9.0.');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What can we suggest here as replacement?

// ContentContext::getCurrentDomain
// TODO: PHP
// TODO: Fusion
$methodCallToWarningComments[] = new MethodCallToWarningComment(LegacyContextStub::class, 'getCurrentDomain', '!! ContentContext::getCurrentDomain() is removed in Neos 9.0.');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What can we suggest here as replacement?

// TODO: PHP
// TODO: Fusion
$methodCallToWarningComments[] = new MethodCallToWarningComment(LegacyContextStub::class, 'getCurrentDomain', '!! ContentContext::getCurrentDomain() is removed in Neos 9.0.');
$fusionNodePropertyPathToWarningComments[] = new FusionNodePropertyPathToWarningComment('context.currentDomain', 'Line %LINE: !! node.context.currentDomain is removed in Neos 9.0.');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What can we suggest here as replacement?

// TODO: PHP
// TODO: Fusion
$methodCallToWarningComments[] = new MethodCallToWarningComment(LegacyContextStub::class, 'getCurrentSiteNode', '!! ContentContext::getCurrentSiteNode() is removed in Neos 9.0.');
$fusionNodePropertyPathToWarningComments[] = new FusionNodePropertyPathToWarningComment('context.currentSiteNode', 'Line %LINE: !! node.context.currentSiteNode is removed in Neos 9.0.');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What can we suggest here as replacement?

@dlubitz dlubitz requested a review from kdambekalns November 2, 2023 09:36
@dlubitz dlubitz changed the title TASK Refactor context methods TASK Refactor ContentContext methods Nov 2, 2023
Copy link
Member

@kitsunet kitsunet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

definitely an improvement.

@ahaeslich ahaeslich marked this pull request as draft November 2, 2023 14:46
@dlubitz dlubitz marked this pull request as ready for review November 2, 2023 15:07
@ahaeslich ahaeslich merged commit 3cae4c0 into main Nov 2, 2023
2 checks passed
@kdambekalns kdambekalns deleted the task/context-methods branch May 14, 2024 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

ContentContext::getCurrentRenderingMode to RenderingModeService::findByCurrentUser
3 participants