I start developing a project based on Sylius and after install process I want to customize Backend Dashboard. As Sylius works with services, I found that BackendMenuBuilder is a service called "sylius.menu_builder.backend". With this in mind and some googling I edited my "services.yml" in AppBundle/Resources/config" and put this lines:
services:
sylius.menu_builder.backend:
class: AppBundle\Menu\Backend\BackendMenu
I created a new class "BackendMenu" in "AppBundle\Menu\Backend" to be called instead the "default" Sylius service. I've got some error in my first tries but after I could overwrite the default service in this way. Is this the right way to do that? For any new service that I want to not use the default version should I insert this new parameter in my "services.yml"? I wonder this because I think developing a medium/big project over Sylius platform and maybe it could be a handy problem.
Instead overwriting whole service definition You can just provide Your own class paramerter. Example:
parameters:
sylius.menu_builder.backend.class: AppBundle\Menu\Backend\BackendMenu
Then You don't need to redeclare all arguments (if there are any).
Other ways it to do this with ComplierPass - http://symfony.com/doc/current/bundles/override.html#services-configuration
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With