Removed deprecated setDefaultOptions methods
This commit is contained in:
parent
db80498bbd
commit
602678143f
@ -12,7 +12,6 @@
|
||||
namespace Symfony\Component\Form;
|
||||
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
||||
|
||||
/**
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
@ -43,16 +42,6 @@ abstract class AbstractType implements FormTypeInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
||||
{
|
||||
$this->configureOptions($resolver);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the options for this type.
|
||||
*
|
||||
* @param OptionsResolver $resolver The resolver for the options.
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
}
|
||||
|
@ -12,7 +12,6 @@
|
||||
namespace Symfony\Component\Form;
|
||||
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
||||
|
||||
/**
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
@ -43,16 +42,6 @@ abstract class AbstractTypeExtension implements FormTypeExtensionInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
||||
{
|
||||
$this->configureOptions($resolver);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the options for this type.
|
||||
*
|
||||
* @param OptionsResolver $resolver The resolver for the options.
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
namespace Symfony\Component\Form;
|
||||
|
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
/**
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
@ -60,15 +60,12 @@ interface FormTypeExtensionInterface
|
||||
public function finishView(FormView $view, FormInterface $form, array $options);
|
||||
|
||||
/**
|
||||
* Overrides the default options from the extended type.
|
||||
* Configures the options for this type.
|
||||
*
|
||||
* @param OptionsResolverInterface $resolver The resolver for the options.
|
||||
* @param OptionsResolver $resolver The resolver for the options.
|
||||
*
|
||||
* @deprecated Deprecated since Symfony 2.7, to be removed in Symfony 3.0.
|
||||
* Use the method configureOptions instead. This method will be
|
||||
* added to the FormTypeExtensionInterface with Symfony 3.0
|
||||
*/
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver);
|
||||
public function configureOptions(OptionsResolver $resolver);
|
||||
|
||||
/**
|
||||
* Returns the name of the type being extended.
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
namespace Symfony\Component\Form;
|
||||
|
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
/**
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
@ -69,15 +69,11 @@ interface FormTypeInterface
|
||||
public function finishView(FormView $view, FormInterface $form, array $options);
|
||||
|
||||
/**
|
||||
* Sets the default options for this type.
|
||||
* Configures the options for this type.
|
||||
*
|
||||
* @param OptionsResolverInterface $resolver The resolver for the options.
|
||||
*
|
||||
* @deprecated Deprecated since Symfony 2.7, to be renamed in Symfony 3.0.
|
||||
* Use the method configureOptions instead. This method will be
|
||||
* added to the FormTypeInterface with Symfony 3.0.
|
||||
* @param OptionsResolver $resolver The resolver for the options.
|
||||
*/
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver);
|
||||
public function configureOptions(OptionsResolver $resolver);
|
||||
|
||||
/**
|
||||
* Returns the name of the parent type.
|
||||
|
@ -192,7 +192,7 @@ class ResolvedFormType implements ResolvedFormTypeInterface
|
||||
/**
|
||||
* Returns the configured options resolver used for this type.
|
||||
*
|
||||
* @return \Symfony\Component\OptionsResolver\OptionsResolverInterface The options resolver.
|
||||
* @return \Symfony\Component\OptionsResolver\OptionsResolver The options resolver.
|
||||
*/
|
||||
public function getOptionsResolver()
|
||||
{
|
||||
@ -203,24 +203,10 @@ class ResolvedFormType implements ResolvedFormTypeInterface
|
||||
$this->optionsResolver = new OptionsResolver();
|
||||
}
|
||||
|
||||
$this->innerType->setDefaultOptions($this->optionsResolver);
|
||||
|
||||
$reflector = new \ReflectionMethod($this->innerType, 'setDefaultOptions');
|
||||
$isOverwritten = ($reflector->getDeclaringClass()->getName() !== 'Symfony\Component\Form\AbstractType');
|
||||
|
||||
if (true === $isOverwritten) {
|
||||
trigger_error('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);
|
||||
}
|
||||
$this->innerType->configureOptions($this->optionsResolver);
|
||||
|
||||
foreach ($this->typeExtensions as $extension) {
|
||||
$extension->setDefaultOptions($this->optionsResolver);
|
||||
|
||||
$reflector = new \ReflectionMethod($extension, 'setDefaultOptions');
|
||||
$isOverwritten = ($reflector->getDeclaringClass()->getName() !== 'Symfony\Component\Form\AbstractTypeExtension');
|
||||
|
||||
if (true === $isOverwritten) {
|
||||
trigger_error('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);
|
||||
}
|
||||
$extension->configureOptions($this->optionsResolver);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ class ResolvedFormTypeTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$givenOptions = array('a' => 'a_custom', 'c' => 'c_custom');
|
||||
$resolvedOptions = array('a' => 'a_custom', 'b' => 'b_default', 'c' => 'c_custom', 'd' => 'd_default');
|
||||
$optionsResolver = $this->getMock('Symfony\Component\OptionsResolver\OptionsResolverInterface');
|
||||
$optionsResolver = $this->getMock('Symfony\Component\OptionsResolver\OptionsResolver');
|
||||
|
||||
$this->resolvedType = $this->getMockBuilder('Symfony\Component\Form\ResolvedFormType')
|
||||
->setConstructorArgs(array($this->type, array($this->extension1, $this->extension2), $this->parentResolvedType))
|
||||
@ -127,7 +127,7 @@ class ResolvedFormTypeTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$givenOptions = array('data_class' => 'Foo');
|
||||
$resolvedOptions = array('data_class' => '\stdClass');
|
||||
$optionsResolver = $this->getMock('Symfony\Component\OptionsResolver\OptionsResolverInterface');
|
||||
$optionsResolver = $this->getMock('Symfony\Component\OptionsResolver\OptionsResolver');
|
||||
|
||||
$this->resolvedType = $this->getMockBuilder('Symfony\Component\Form\ResolvedFormType')
|
||||
->setConstructorArgs(array($this->type, array($this->extension1, $this->extension2), $this->parentResolvedType))
|
||||
|
Reference in New Issue
Block a user