mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 15:51:48 +03:00
parent
d25dd30453
commit
9df40af264
@ -144,21 +144,31 @@ class FormTypeParser implements ParserInterface
|
|||||||
$type instanceof FormInterface || $type instanceof ResolvedFormTypeInterface;
|
$type instanceof FormInterface || $type instanceof ResolvedFormTypeInterface;
|
||||||
$type = $type->getParent()
|
$type = $type->getParent()
|
||||||
) {
|
) {
|
||||||
if (isset($this->mapTypes[$type->getName()])) {
|
$typeName = method_exists($type, 'getBlockPrefix') ?
|
||||||
$bestType = $this->mapTypes[$type->getName()];
|
$type->getBlockPrefix() : $type->getName();
|
||||||
|
|
||||||
|
if (isset($this->mapTypes[$typeName])) {
|
||||||
|
$bestType = $this->mapTypes[$typeName];
|
||||||
$actualType = $bestType;
|
$actualType = $bestType;
|
||||||
} elseif ('collection' === $type->getName()) {
|
} elseif ('collection' === $typeName) {
|
||||||
if (is_string($config->getOption('type')) && isset($this->mapTypes[$config->getOption('type')])) {
|
$typeOption = $config->getOption('type');
|
||||||
$subType = $this->mapTypes[$config->getOption('type')];
|
|
||||||
|
if (is_object($typeOption)) {
|
||||||
|
$typeOption = method_exists($typeOption, 'getBlockPrefix') ?
|
||||||
|
$typeOption->getBlockPrefix() : $typeOption->getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($this->mapTypes[$typeOption])) {
|
||||||
|
$subType = $this->mapTypes[$typeOption];
|
||||||
$actualType = DataTypes::COLLECTION;
|
$actualType = DataTypes::COLLECTION;
|
||||||
$bestType = sprintf('array of %ss', $subType);
|
$bestType = sprintf('array of %ss', $subType);
|
||||||
} else {
|
} else {
|
||||||
// Embedded form collection
|
// Embedded form collection
|
||||||
$embbededType = $config->getOption('type');
|
$embbededType = $config->getOption('type');
|
||||||
$subForm = $this->formFactory->create($embbededType, null, $config->getOption('options', array()));
|
$subForm = $this->formFactory->create($embbededType, null, $config->getOption('options', array()));
|
||||||
$children = $this->parseForm($subForm);
|
$children = $this->parseForm($subForm);
|
||||||
$actualType = DataTypes::COLLECTION;
|
$actualType = DataTypes::COLLECTION;
|
||||||
$subType = is_object($embbededType) ? get_class($embbededType) : $embbededType;
|
$subType = is_object($embbededType) ? get_class($embbededType) : $embbededType;
|
||||||
|
|
||||||
if (class_exists($subType)) {
|
if (class_exists($subType)) {
|
||||||
$parts = explode('\\', $subType);
|
$parts = explode('\\', $subType);
|
||||||
@ -263,7 +273,12 @@ class FormTypeParser implements ParserInterface
|
|||||||
if (($choices = $config->getOption('choices')) && is_array($choices) && count($choices)) {
|
if (($choices = $config->getOption('choices')) && is_array($choices) && count($choices)) {
|
||||||
$parameters[$name]['format'] = json_encode($choices);
|
$parameters[$name]['format'] = json_encode($choices);
|
||||||
} elseif ($choiceList = $config->getOption('choice_list')) {
|
} elseif ($choiceList = $config->getOption('choice_list')) {
|
||||||
if (('entity' === $config->getType()->getName() && false === $this->entityToChoice)) {
|
$choiceListType = $config->getType();
|
||||||
|
$choiceListName = method_exists($choiceListType, 'getBlockPrefix') ?
|
||||||
|
$choiceListType->getBlockPrefix() : $choiceListType->getName();
|
||||||
|
|
||||||
|
|
||||||
|
if (('entity' === $choiceListName && false === $this->entityToChoice)) {
|
||||||
$choices = array();
|
$choices = array();
|
||||||
} else {
|
} else {
|
||||||
// TODO: fixme
|
// TODO: fixme
|
||||||
|
@ -19,11 +19,6 @@ use Symfony\Component\HttpKernel\Kernel;
|
|||||||
*/
|
*/
|
||||||
class AppKernel extends Kernel
|
class AppKernel extends Kernel
|
||||||
{
|
{
|
||||||
public function __construct($environment, $debug)
|
|
||||||
{
|
|
||||||
parent::__construct($environment, $debug);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function registerBundles()
|
public function registerBundles()
|
||||||
{
|
{
|
||||||
$bundles = array(
|
$bundles = array(
|
||||||
|
@ -39,16 +39,18 @@ abstract class WebTestCase extends BaseWebTestCase
|
|||||||
|
|
||||||
protected function getContainer(array $options = array())
|
protected function getContainer(array $options = array())
|
||||||
{
|
{
|
||||||
|
if (!static::$kernel) {
|
||||||
|
static::$kernel = static::createKernel($options);
|
||||||
|
}
|
||||||
|
|
||||||
|
static::$kernel->boot();
|
||||||
|
|
||||||
if (!static::$container) {
|
if (!static::$container) {
|
||||||
if (!static::$kernel) {
|
|
||||||
static::$kernel = static::createKernel($options);
|
|
||||||
}
|
|
||||||
|
|
||||||
static::$kernel->boot();
|
|
||||||
|
|
||||||
static::$container = static::$kernel->getContainer();
|
static::$container = static::$kernel->getContainer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static::$container->set('kernel', static::$kernel);
|
||||||
|
|
||||||
return static::$container;
|
return static::$container;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user