[Form] Fixed compatibility with FormTypeInterface implementations that don't extend AbstractType
This commit is contained in:
parent
c216565bc2
commit
4a1ad7e4c6
@ -200,6 +200,7 @@ class ResolvedFormType implements ResolvedFormTypeInterface
|
|||||||
|
|
||||||
$this->innerType->setDefaultOptions($this->optionsResolver);
|
$this->innerType->setDefaultOptions($this->optionsResolver);
|
||||||
|
|
||||||
|
if (method_exists($this->innerType, 'configureOptions')) {
|
||||||
$reflector = new \ReflectionMethod($this->innerType, 'setDefaultOptions');
|
$reflector = new \ReflectionMethod($this->innerType, 'setDefaultOptions');
|
||||||
$isOldOverwritten = $reflector->getDeclaringClass()->getName() !== 'Symfony\Component\Form\AbstractType';
|
$isOldOverwritten = $reflector->getDeclaringClass()->getName() !== 'Symfony\Component\Form\AbstractType';
|
||||||
|
|
||||||
@ -209,10 +210,14 @@ class ResolvedFormType implements ResolvedFormTypeInterface
|
|||||||
if ($isOldOverwritten && !$isNewOverwritten) {
|
if ($isOldOverwritten && !$isNewOverwritten) {
|
||||||
@trigger_error(get_class($this->innerType).': The FormTypeInterface::setDefaultOptions() method is deprecated since version 2.7 and will be removed in 3.0. Use configureOptions() instead. This method will be added to the FormTypeInterface with Symfony 3.0.', E_USER_DEPRECATED);
|
@trigger_error(get_class($this->innerType).': The FormTypeInterface::setDefaultOptions() method is deprecated since version 2.7 and will be removed in 3.0. Use configureOptions() instead. This method will be added to the FormTypeInterface with Symfony 3.0.', E_USER_DEPRECATED);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
@trigger_error(get_class($this->innerType).': The FormTypeInterface::configureOptions() method will be added in Symfony 3.0. You should extend AbstractType or implement it in your classes.', E_USER_DEPRECATED);
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($this->typeExtensions as $extension) {
|
foreach ($this->typeExtensions as $extension) {
|
||||||
$extension->setDefaultOptions($this->optionsResolver);
|
$extension->setDefaultOptions($this->optionsResolver);
|
||||||
|
|
||||||
|
if (method_exists($extension, 'configureOptions')) {
|
||||||
$reflector = new \ReflectionMethod($extension, 'setDefaultOptions');
|
$reflector = new \ReflectionMethod($extension, 'setDefaultOptions');
|
||||||
$isOldOverwritten = $reflector->getDeclaringClass()->getName() !== 'Symfony\Component\Form\AbstractTypeExtension';
|
$isOldOverwritten = $reflector->getDeclaringClass()->getName() !== 'Symfony\Component\Form\AbstractTypeExtension';
|
||||||
|
|
||||||
@ -222,6 +227,9 @@ class ResolvedFormType implements ResolvedFormTypeInterface
|
|||||||
if ($isOldOverwritten && !$isNewOverwritten) {
|
if ($isOldOverwritten && !$isNewOverwritten) {
|
||||||
@trigger_error(get_class($extension).': The FormTypeExtensionInterface::setDefaultOptions() method is deprecated since version 2.7 and will be removed in 3.0. Use configureOptions() instead. This method will be added to the FormTypeExtensionInterface with Symfony 3.0.', E_USER_DEPRECATED);
|
@trigger_error(get_class($extension).': The FormTypeExtensionInterface::setDefaultOptions() method is deprecated since version 2.7 and will be removed in 3.0. Use configureOptions() instead. This method will be added to the FormTypeExtensionInterface with Symfony 3.0.', E_USER_DEPRECATED);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
@trigger_error(get_class($this->innerType).': The FormTypeExtensionInterface::configureOptions() method will be added in Symfony 3.0. You should extend AbstractTypeExtension or implement it in your classes.', E_USER_DEPRECATED);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user