Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9df40af

Browse filesBrowse files
committed
Support Symfony 2.8+
Fix #738
1 parent d25dd30 commit 9df40af
Copy full SHA for 9df40af

File tree

Expand file treeCollapse file tree

3 files changed

+32
-20
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+32
-20
lines changed

‎Parser/FormTypeParser.php

Copy file name to clipboardExpand all lines: Parser/FormTypeParser.php
+25-10Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -144,21 +144,31 @@ private function parseForm($form)
144144
$type instanceof FormInterface || $type instanceof ResolvedFormTypeInterface;
145145
$type = $type->getParent()
146146
) {
147-
if (isset($this->mapTypes[$type->getName()])) {
148-
$bestType = $this->mapTypes[$type->getName()];
147+
$typeName = method_exists($type, 'getBlockPrefix') ?
148+
$type->getBlockPrefix() : $type->getName();
149+
150+
if (isset($this->mapTypes[$typeName])) {
151+
$bestType = $this->mapTypes[$typeName];
149152
$actualType = $bestType;
150-
} elseif ('collection' === $type->getName()) {
151-
if (is_string($config->getOption('type')) && isset($this->mapTypes[$config->getOption('type')])) {
152-
$subType = $this->mapTypes[$config->getOption('type')];
153+
} elseif ('collection' === $typeName) {
154+
$typeOption = $config->getOption('type');
155+
156+
if (is_object($typeOption)) {
157+
$typeOption = method_exists($typeOption, 'getBlockPrefix') ?
158+
$typeOption->getBlockPrefix() : $typeOption->getName();
159+
}
160+
161+
if (isset($this->mapTypes[$typeOption])) {
162+
$subType = $this->mapTypes[$typeOption];
153163
$actualType = DataTypes::COLLECTION;
154164
$bestType = sprintf('array of %ss', $subType);
155165
} else {
156166
// Embedded form collection
157167
$embbededType = $config->getOption('type');
158-
$subForm = $this->formFactory->create($embbededType, null, $config->getOption('options', array()));
159-
$children = $this->parseForm($subForm);
160-
$actualType = DataTypes::COLLECTION;
161-
$subType = is_object($embbededType) ? get_class($embbededType) : $embbededType;
168+
$subForm = $this->formFactory->create($embbededType, null, $config->getOption('options', array()));
169+
$children = $this->parseForm($subForm);
170+
$actualType = DataTypes::COLLECTION;
171+
$subType = is_object($embbededType) ? get_class($embbededType) : $embbededType;
162172

163173
if (class_exists($subType)) {
164174
$parts = explode('\\', $subType);
@@ -263,7 +273,12 @@ private function parseForm($form)
263273
if (($choices = $config->getOption('choices')) && is_array($choices) && count($choices)) {
264274
$parameters[$name]['format'] = json_encode($choices);
265275
} elseif ($choiceList = $config->getOption('choice_list')) {
266-
if (('entity' === $config->getType()->getName() && false === $this->entityToChoice)) {
276+
$choiceListType = $config->getType();
277+
$choiceListName = method_exists($choiceListType, 'getBlockPrefix') ?
278+
$choiceListType->getBlockPrefix() : $choiceListType->getName();
279+
280+
281+
if (('entity' === $choiceListName && false === $this->entityToChoice)) {
267282
$choices = array();
268283
} else {
269284
// TODO: fixme

‎Tests/Fixtures/app/AppKernel.php

Copy file name to clipboardExpand all lines: Tests/Fixtures/app/AppKernel.php
-5Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@
1919
*/
2020
class AppKernel extends Kernel
2121
{
22-
public function __construct($environment, $debug)
23-
{
24-
parent::__construct($environment, $debug);
25-
}
26-
2722
public function registerBundles()
2823
{
2924
$bundles = array(

‎Tests/WebTestCase.php

Copy file name to clipboardExpand all lines: Tests/WebTestCase.php
+7-5Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,18 @@ public static function handleDeprecation($errorNumber, $message, $file, $line, $
3939

4040
protected function getContainer(array $options = array())
4141
{
42-
if (!static::$container) {
43-
if (!static::$kernel) {
44-
static::$kernel = static::createKernel($options);
45-
}
42+
if (!static::$kernel) {
43+
static::$kernel = static::createKernel($options);
44+
}
4645

47-
static::$kernel->boot();
46+
static::$kernel->boot();
4847

48+
if (!static::$container) {
4949
static::$container = static::$kernel->getContainer();
5050
}
5151

52+
static::$container->set('kernel', static::$kernel);
53+
5254
return static::$container;
5355
}
5456

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.