Created
May 14, 2011 14:23
-
-
Save winzou/972258 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# winzouBookBundle | |
winzou_book: | |
entry: | |
entity: | |
class: Asso\BookBundle\Entity\Entry | |
manager: | |
class: Asso\BookBundle\Entity\Manager\EntryManager |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
winzou_book.entry_manager: | |
class: %winzou_book.entry.manager.class% | |
arguments: [@doctrine.orm.entity_manager, %winzou_book.entry.entity.class%] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace winzou\BookBundle\DependencyInjection; | |
use Symfony\Component\Config\Definition\Builder\TreeBuilder; | |
class Configuration | |
{ | |
public function getConfigTree() | |
{ | |
$treeBuilder = new TreeBuilder(); | |
$rootNode = $treeBuilder->root('winzou_book'); | |
$rootNode | |
->children() | |
->arrayNode('entry') | |
->children() | |
->arrayNode('entity') | |
->children() | |
->scalarNode('class')->isRequired()->cannotBeEmpty()->end() | |
->end() | |
->end() | |
->arrayNode('manager') | |
->children() | |
->scalarNode('class')->defaultValue('winzou\\BookBundle\\Entity\\Manager\\EntryManager')->end() | |
->end() | |
->end() | |
->end() | |
->end() | |
->arrayNode('account') | |
->children() | |
->arrayNode('entity') | |
->children() | |
->scalarNode('class')->defaultValue('winzou\\BookBundle\\Entity\\Account')->end() | |
->end() | |
->end() | |
->arrayNode('manager') | |
->children() | |
->scalarNode('class')->defaultValue('winzou\\BookBundle\\Entity\\Manager\\AccountManager')->end() | |
->end() | |
->end() | |
->end() | |
->end() | |
->end(); | |
return $treeBuilder->buildTree(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace winzou\BookBundle\DependencyInjection; | |
use Symfony\Component\Config\Definition\Processor; | |
use Symfony\Component\DependencyInjection\ContainerBuilder; | |
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; | |
use Symfony\Component\HttpKernel\DependencyInjection\Extension; | |
use Symfony\Component\Config\FileLocator; | |
class winzouBookExtension extends Extension | |
{ | |
public function load(array $configs, ContainerBuilder $container) | |
{ | |
$processor = new Processor(); | |
$configuration = new Configuration(); | |
$config = $processor->process($configuration->getConfigTree(), $configs); | |
var_dump($config); | |
$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); | |
$loader->load('services.yml'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment