suchen

Heim  >  Fragen und Antworten  >  Hauptteil

symfony – sylius ResourceController definiert Konstruktor

Die häufigste Ursache ist, dass Sylius einen Konstruktor im ResourceController von ResourceBundle angepasst hat.

öffentliche Funktion __construct(Configuration $config)
{
$this->config = $config;
}

Sie können den Konstruktor im Symfony2-Controller nicht anpassen. Ich weiß nicht, wie er es geschafft hat

迷茫迷茫2829 Tage vor574

Antworte allen(1)Ich werde antworten

  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-16 16:46:21

    将controller作为一个service,路由表中使用sylius.controller.cart:indexAction这样的形式,这样就可以在发送请求的同时,将service初始化。至于构造函数中的参数,就依你的service.xml的argument属性而定。依赖注入的方式比较灵活,可以配置xml或者yml,也可以在DependencyInjection文件中配置

    Antwort
    0
  • StornierenAntwort