Upgraded to Symfony 2.1-beta2

This commit is contained in:
Polonkai Gergely
2012-07-15 14:56:31 +02:00
parent c1232c9792
commit bb7aee6fee
455 changed files with 21001 additions and 18480 deletions

View File

@@ -3,20 +3,22 @@
namespace Sensio\Bundle\FrameworkExtraBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Config\Definition\NodeInterface;
/**
* FrameworkExtraBundle configuration structure.
*
* @author Henrik Bjornskov <hb@peytz.dk>
*/
class Configuration
class Configuration implements ConfigurationInterface
{
/**
* Generates the configuration tree.
*
* @return Symfony\Component\Config\Definition\NodeInterface
* @return NodeInterface
*/
public function getConfigTree()
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('sensio_framework_extra', 'array');
@@ -50,6 +52,6 @@ class Configuration
->end()
;
return $treeBuilder->buildTree();
return $treeBuilder;
}
}

View File

@@ -7,7 +7,6 @@ use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Definition\Processor;
/*
* This file is part of the Symfony framework.
@@ -21,19 +20,16 @@ use Symfony\Component\Config\Definition\Processor;
/**
* SensioFrameworkExtraExtension.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Fabien Potencier <fabien@symfony.com>
*/
class SensioFrameworkExtraExtension extends Extension
{
public function load(array $configs, ContainerBuilder $container)
{
$configuration = $this->getConfiguration($configs, $container);
$config = $this->processConfiguration($configuration, $configs);
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$processor = new Processor();
$configuration = new Configuration();
$config = $processor->process($configuration->getConfigTree(), $configs);
$loader->load('services.xml');
$annotationsToLoad = array();

View File

@@ -57,11 +57,12 @@ class DoctrineParamConverter implements ParamConverterInterface
protected function find($class, Request $request, $options)
{
if (!$request->attributes->has('id')) {
$key = isset($options['id']) ? $options['id'] : 'id';
if (!$request->attributes->has($key)) {
return false;
}
return $this->registry->getRepository($class, $options['entity_manager'])->find($request->attributes->get('id'));
return $this->registry->getRepository($class, $options['entity_manager'])->find($request->attributes->get($key));
}
protected function findOneBy($class, Request $request, $options)

View File

@@ -63,6 +63,17 @@ be configured with the ``entity_manager`` option::
{
}
If the placeholder has not the same name as the primary key, pass the ``id``
option::
/**
* @Route("/blog/{post_id}")
* @ParamConverter("post", class="SensioBlogBundle:Post", options={"id" = "post_id"})
*/
public function showAction(Post $post)
{
}
Creating a Converter
--------------------