Reputation: 1
I want to display a custom calendar template showing the previous orders made for the current product. I already have the template, because I already use it in the Order Admin Panel, so I just need to load the template with the correct data, because it's not being imported by default on this page.
Usually on a Symfony project, we just need to load data to a Twig template through a controller.
Although, since Sylius 2.0 came out, a lot of the extendable controllers doesn't exists anymore, like the OrderController
that could solve my issue in this case. And, unlike the 1.0, there's no pages in the 2.0 documentation mentioning how to customize a controller.
This is a use case example of a controller that could be useful, but this isn't the first time I encountered a feature implementation issue that could be simply fixed by a controller.
Is there a way to customize a controller in Sylius 2.0 ?
I found out a way to display my calendar though. And to be fair, I do not think it's really neither secure nor future proof. Tell me if there's an issue revolving this temporary fix :
services.yaml
{% set orders = get_product_orders(product) %}
If I do not found a proper way to extend a controller, I might raise an issue on the Github repo
Upvotes: -1
Views: 27