Revert "Throw exception when "date_widget" option is not equal to "time_widget""
This reverts commit 3c2539fccb
.
Conflicts:
tests/Symfony/Tests/Component/Form/Extension/Core/Type/DateTimeTypeTest.php
This commit is contained in:
parent
8a574ad078
commit
1b395f5351
@ -16,7 +16,6 @@ use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\Form\FormBuilder;
|
||||
use Symfony\Component\Form\FormView;
|
||||
use Symfony\Component\Form\ReversedTransformer;
|
||||
use Symfony\Component\Form\Exception\FormException;
|
||||
use Symfony\Component\Form\Extension\Core\DataTransformer\DataTransformerChain;
|
||||
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToArrayTransformer;
|
||||
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer;
|
||||
@ -41,10 +40,6 @@ class DateTimeType extends AbstractType
|
||||
$timeParts[] = 'second';
|
||||
}
|
||||
|
||||
if ($options['date_widget'] !== $options['time_widget']) {
|
||||
throw new FormException(sprintf('Options "date_widget" and "time_widget" need to be identical. Used: "date_widget" = "%s" and "time_widget" = "%s".', $options['date_widget'] ?: 'choice', $options['time_widget'] ?: 'choice'));
|
||||
}
|
||||
|
||||
if ($options['widget'] === 'single_text') {
|
||||
$builder->appendClientTransformer(new DateTimeToStringTransformer($options['data_timezone'], $options['user_timezone'], $format));
|
||||
} else {
|
||||
|
@ -193,27 +193,6 @@ class DateTimeTypeTest extends LocalizedTestCase
|
||||
$this->assertEquals('2010-06-02 03:04:00', $form->getClientData());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Symfony\Component\Form\Exception\FormException
|
||||
*/
|
||||
public function testDifferentWidgets()
|
||||
{
|
||||
$form = $this->factory->create('datetime', null, array(
|
||||
'date_widget' => 'single_text',
|
||||
'time_widget' => 'choice',
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Symfony\Component\Form\Exception\FormException
|
||||
*/
|
||||
public function testDefinedOnlyOneWidget()
|
||||
{
|
||||
$form = $this->factory->create('datetime', null, array(
|
||||
'date_widget' => 'single_text',
|
||||
));
|
||||
}
|
||||
|
||||
public function testSubmit_differentPattern()
|
||||
{
|
||||
$form = $this->factory->create('datetime', null, array(
|
||||
|
Reference in New Issue
Block a user