-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Fixed 24990: link doesn't redirect to dashboard #26100
Fixed 24990: link doesn't redirect to dashboard #26100
Conversation
Hi @Usik2203. Thank you for your contribution
For more details, please, review the Magento Contributor Guide documentation. |
@magento give me test instance |
Hi @Usik2203. Thank you for your request. I'm working on Magento instance for you |
Hi @Usik2203, here is your new Magento instance. |
/** | ||
* @param NavModel $navigation | ||
* @param Status $status | ||
*/ | ||
public function __construct(NavModel $navigation, Status $status) | ||
public function __construct(NavModel $navigation, Status $status, ObjectManagerProvider $objectManagerProvider) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you use ObjectManagerProvider
instead of injecting just UrlInterface
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am getting such error "An error occurred during execution; please try again later" and status 500 while injecting UrlInterface
directly in constructor of controller
Hi @Usik2203, thank you for your contribution! |
@magento give me test instance |
Hi @Usik2203. Thank you for your request. I'm working on Magento instance for you |
Hi @Usik2203, here is your new Magento instance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Instantiation of the classes with
new
keyword - Use of Object Manager.
@@ -57,7 +59,7 @@ public function __construct(NavModel $navigation, Status $status, ObjectManagerP | |||
*/ | |||
public function indexAction() | |||
{ | |||
$json = new JsonModel; | |||
$json = new JsonModel(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you instantiating classes with new
instead of using Factory
or just Dependency Injection?
/** @var \Magento\Backend\Model\UrlInterface $backendUrl */ | ||
$backendUrl = $this->objectManagerProvider->get()->get(\Magento\Backend\Model\UrlInterface::class); | ||
/** @var UrlInterface $backendUrl */ | ||
$backendUrl = $this->objectManagerProvider->get()->get(UrlInterface::class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should inject that class to the constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @lbajsarowicz ,
Unfortunately I can't inject \Magento\Backend\Model\UrlInterface
directly to constructor. I get such error.
Also I want to notice that construction like this $this->objectManagerProvider->get()
is used in a lot of cases.
If such approach is wrong, maybe You could advise me something ?
Thanks a lot!
@@ -47,7 +49,7 @@ public function __construct(NavModel $navigation, Status $status, ObjectManagerP | |||
$this->navigation = $navigation; | |||
$this->status = $status; | |||
$this->objectManagerProvider = $objectManagerProvider; | |||
$this->view = new ViewModel; | |||
$this->view = new ViewModel(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you instantiating classes with new
instead of using Factory
or just Dependency Injection?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @lbajsarowicz . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Usik2203, could you please fix the conflicting file?
Thank you.
Sorry, I've tried to unassign me from the PR. |
Hi @lbajsarowicz, thank you for the review. |
Hi @Usik2203, thank you for your contribution! |
Description (*)
This PR fixed #24990 issue
Fixed Issues (if relevant)
Manual testing scenarios (*)
Questions or comments
Contribution checklist (*)