The most common one is that sylius has customized a constructor in the ResourceController of ResourceBundle.
public function __construct(Configuration $config)
{
$this->config = $config;
}
You cannot customize the constructor in the symfony2 Controller. Don't know how he achieved it
曾经蜡笔没有小新2017-05-16 16:46:21
Use the controller as a service and use the form sylius.controller.cart:indexAction in the routing table, so that the service can be initialized while sending the request. As for the parameters in the constructor, it depends on the argument attribute of your service.xml. The dependency injection method is more flexible. It can be configured in xml or yml, or it can be configured in the DependencyInjection file