设为首页 加入收藏

TOP

Symfony 服务配置 看这一篇就够了(二)
2019-09-17 15:02:55 】 浏览:95
Tags:Symfony 服务 配置 一篇
就是 false。autowire:false 意味着如果服务的构造方法中需要参数,则必须手动的在
79 # arguments 字段中明确的设置。 80 # 也就是说所谓的 autowire 就是自动注入构造方法中所需要的参数而无须手动声明。 81 App\Services\TestAutowire\TestAutowire: 82 class: App\Services\TestAutowire\TestAutowire 83 public: true 84 arguments: 85 - '@App\Services\TestAutowire\TestAutowireArg' 86 App\Services\TestAutowire\TestAutowireArg: 87 class: App\Services\TestAutowire\TestAutowireArg 88 89 # 设置了 autowire:true 则无需手动设置构造方法的参数了 90 # App\Services\TestAutowire\TestAutowire: 91 # class: App\Services\TestAutowire\TestAutowire 92 # public: true 93 # autowire: true 94 # App\Services\TestAutowire\TestAutowireArg: 95 # class: App\Services\TestAutowire\TestAutowireArg 96 97 ############################## 父服务与子服务 ############################################################ 98 App\Services\ParentAndChild\ParentService: 99 class: App\Services\ParentAndChild\ParentService 100 public: true 101 abstract: true 102 arguments: 103 $someService1: '@App\Services\ParentAndChild\SomeService1' 104 $someService2: '@App\Services\ParentAndChild\SomeService2' 105 App\Services\ParentAndChild\ChildService: 106 class: App\Services\ParentAndChild\ChildService 107 parent: App\Services\ParentAndChild\ParentService 108 public: true 109 # 波浪线表示 null,容器会使用默认的设置,不能通过 get() 获取,因为默认 public:false 110 App\Services\ParentAndChild\SomeService1: ~ 111 App\Services\ParentAndChild\SomeService2: ~

 

首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Yii2中$model->load($data)一.. 下一篇PHP 格式化显示时间 date 函数

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目