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
feat: Add order criteria event to OrderRoute #3683
feat: Add order criteria event to OrderRoute #3683
Conversation
As with all other Store API routes, it is possible to modify the Criteria by decorating the Route: Other routes, such as the |
The problem is, that in our use case we need to remove the |
return $this->criteria; | ||
} | ||
|
||
public function getContext(): SalesChannelContext |
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.
This would be better, wouldn't it? Like in many other Events
public function getContext(): Context
{
return $this->salesChannelContext->getContext();
}
public function getSalesChannelContext(): SalesChannelContext
{
return $this->salesChannelContext;
}
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 just adjusted the code.
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.
Missing use Shopware\Core\Framework\Context;
?
92b9d30
to
970f6b2
Compare
use Shopware\Core\System\SalesChannel\SalesChannelContext; | ||
use Symfony\Contracts\EventDispatcher\Event; | ||
|
||
class OrderCriteriaEvent extends Event |
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.
Just as icing on the cake, could you implement \Shopware\Core\Framework\Event\ShopwareSalesChannelEvent
here? Then we will import it 👍
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 just added.
970f6b2
to
5a37851
Compare
Hello, thank you for creating this pull request. Please use this issue to track the state of your pull request. |
Your PR has been merged, thank you for your contribution 🎉 💙 |
1. Why is this change necessary?
Currently it is not possible to modify the order criteria inside the OrderRoute.
2. What does this change do, exactly?
Add criteria event to modify the criteria.
3. Describe each step to reproduce the issue or behaviour.
-
4. Please link to the relevant issues (if any).
-
5. Checklist