Backported the bundle to support Symfony 2.0.x

This commit is contained in:
Christophe Coevoet 2012-05-23 00:02:38 +02:00
parent b40c8de125
commit e11ee357b5
8 changed files with 25 additions and 16 deletions

View File

@ -200,7 +200,7 @@ class ApiDocExtractor
} }
} }
$route->addOptions(array('_paramDocs' => $paramDocs)); $route->setOptions(array_merge($route->getOptions(), array('_paramDocs' => $paramDocs)));
return array('annotation' => $annotation, 'route' => $route); return array('annotation' => $annotation, 'route' => $route);
} }

View File

@ -37,7 +37,7 @@ class DescriptionFieldTypeExtension extends AbstractTypeExtension
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getDefaultOptions() public function getDefaultOptions(array $options)
{ {
return array( return array(
'description' => '', 'description' => '',

View File

@ -54,8 +54,12 @@ class FormTypeParser
{ {
$builder = $this->formFactory->createBuilder($type); $builder = $this->formFactory->createBuilder($type);
$refl = new \ReflectionProperty('Symfony\Component\Form\FormBuilder', 'children');
$refl->setAccessible(true);
$children = $refl->getValue($builder);
$parameters = array(); $parameters = array();
foreach ($builder->all() as $name => $child) { foreach ($children as $name => $child) {
if ($child instanceof FormBuilder) { if ($child instanceof FormBuilder) {
$childBuilder = $child; $childBuilder = $child;
} else { } else {

View File

@ -29,7 +29,7 @@ class TestType extends AbstractType
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getDefaultOptions() public function getDefaultOptions(array $options)
{ {
return array( return array(
'data_class' => 'Nelmio\ApiDocBundle\Tests\Fixtures\Model\Test', 'data_class' => 'Nelmio\ApiDocBundle\Tests\Fixtures\Model\Test',
@ -38,6 +38,6 @@ class TestType extends AbstractType
public function getName() public function getName()
{ {
return ''; return 'foobar';
} }
} }

View File

@ -7,11 +7,11 @@ framework:
validation: { enabled: true, enable_annotations: true } validation: { enabled: true, enable_annotations: true }
form: ~ form: ~
test: ~ test: ~
default_locale: en
session: session:
default_locale: en
auto_start: true auto_start: true
storage_id: session.storage.mock_file storage_id: session.storage.filesystem
profiler: { only_exceptions: false } profiler: false
templating: { engines: ['twig'] } templating: { engines: ['twig'] }
# Twig Configuration # Twig Configuration

View File

@ -12,7 +12,7 @@
namespace Nelmio\ApiDocBundle\Tests; namespace Nelmio\ApiDocBundle\Tests;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase as BaseWebTestCase; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase as BaseWebTestCase;
use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\HttpKernel\Util\Filesystem;
use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\HttpKernel\Kernel;
abstract class WebTestCase extends BaseWebTestCase abstract class WebTestCase extends BaseWebTestCase

View File

@ -12,3 +12,7 @@ if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader
'curl -s http://getcomposer.org/installer | php'.PHP_EOL. 'curl -s http://getcomposer.org/installer | php'.PHP_EOL.
'php composer.phar install'.PHP_EOL); 'php composer.phar install'.PHP_EOL);
} }
if (class_exists('Doctrine\Common\Annotations\AnnotationRegistry')) {
\Doctrine\Common\Annotations\AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
}

View File

@ -15,15 +15,16 @@
} }
], ],
"require": { "require": {
"symfony/framework-bundle": "2.1.*", "symfony/symfony": "2.0.*",
"symfony/twig-bundle": "2.1.*", "symfony/framework-bundle": "2.0.*",
"symfony/form": "2.1.*" "symfony/twig-bundle": "2.0.*",
"symfony/form": "2.0.*"
}, },
"require-dev": { "require-dev": {
"symfony/css-selector": "2.1.*", "symfony/css-selector": "2.0.*",
"symfony/browser-kit": "2.1.*", "symfony/browser-kit": "2.0.*",
"symfony/validator": "2.1.*", "symfony/validator": "2.0.*",
"symfony/yaml": "2.1.*" "symfony/yaml": "2.0.*"
}, },
"autoload": { "autoload": {
"psr-0": { "Nelmio\\ApiDocBundle": "" } "psr-0": { "Nelmio\\ApiDocBundle": "" }