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);
}

View File

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

View File

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

View File

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

View File

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

View File

@ -12,7 +12,7 @@
namespace Nelmio\ApiDocBundle\Tests;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase as BaseWebTestCase;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpKernel\Util\Filesystem;
use Symfony\Component\HttpKernel\Kernel;
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.
'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": {
"symfony/framework-bundle": "2.1.*",
"symfony/twig-bundle": "2.1.*",
"symfony/form": "2.1.*"
"symfony/symfony": "2.0.*",
"symfony/framework-bundle": "2.0.*",
"symfony/twig-bundle": "2.0.*",
"symfony/form": "2.0.*"
},
"require-dev": {
"symfony/css-selector": "2.1.*",
"symfony/browser-kit": "2.1.*",
"symfony/validator": "2.1.*",
"symfony/yaml": "2.1.*"
"symfony/css-selector": "2.0.*",
"symfony/browser-kit": "2.0.*",
"symfony/validator": "2.0.*",
"symfony/yaml": "2.0.*"
},
"autoload": {
"psr-0": { "Nelmio\\ApiDocBundle": "" }