Skip to content

Commit

Permalink
merged branch xavierbriand/pr-datetime-type (PR symfony#3604)
Browse files Browse the repository at this point in the history
Commits
-------

1b395f5 Revert "Throw exception when "date_widget" option is not equal to "time_widget""

Discussion
----------

Reverts commit 3c2539 to remove exception when DateTypeType has differents date and time widgets

see symfony#1419
  • Loading branch information
fabpot committed Mar 15, 2012
2 parents 8a574ad + 1b395f5 commit de5e80b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
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;
Expand All @@ -41,10 +40,6 @@ public function buildForm(FormBuilder $builder, array $options)
$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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,27 +193,6 @@ public function testSubmit_stringSingleText()
$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(
Expand Down

0 comments on commit de5e80b

Please sign in to comment.