Services and dependency injection

By admin, 15 二月, 2022

Drupal 8以后开始使用面向对象方式编写,其中一个重要的设计模式是使用服务容器和依赖注入。改模式的一个重要用途是可以写一些stub进行单元测试。

Drupal用这个模式源自其依赖的Symfony:

 

Laravel从5.0开始就引入了这个模式:https://laravel.com/docs/9.x/container

Services and dependency injection in Drupal 8+

标签

评论

Restricted HTML

  • 允许的HTML标签:<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <img src>
  • 自动断行和分段。
  • 网页和电子邮件地址自动转换为链接。
验证码
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
请输入"Drupal10"