我是symfony Bundle System的新手。
我正在读这个:
http://symfony.com/doc/current/cookbook/bundles/configuration.html
所以在我接下来的所有配置完成之后呢?
我的意思是我在哪里可以在我的应用程序中使用所有这些配置?
我真的不明白config.yml中的那些值在配置之后的位置。
有人可以解释接下来会发生什么吗?
答案 0 :(得分:0)
这些值将自动存储在容器中。
如果您有此配置:
Const cstrOldName As String = "dbo_tblFoo2"
Dim db As DAO.Database
Dim tdfOld As DAO.TableDef
Dim tdfNew As DAO.TableDef
Set db = CurrentDb
Set tdfOld = db.TableDefs(cstrOldName)
tdfOld.Name = cstrOldName & "_old" ' rename the old link
Set tdfNew = db.CreateTableDef
With tdfNew
.Name = cstrOldName
.Connect = tdfOld.Connect
.SourceTableName = "dbo.Dual"
End With
db.TableDefs.Append tdfNew
您可以从控制器中读取它,如下所示:
// src/Acme/SocialBundle/DependencyInjection/Configuration.php
namespace Acme\SocialBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('acme_social');
$rootNode
->children()
->arrayNode('twitter')
->children()
->integerNode('client_id')->end()
->scalarNode('client_secret')->end()
->end()
->end() // twitter
->end()
;
return $treeBuilder;
}
}