Merge branch '4.4' into 5.2
* 4.4: [Form] Ignoring invalid forms from delete_empty behavior in CollectionType Add Symfony Armenian Translations cs fix Add different header notations to tests
This commit is contained in:
commit
8cec0b6391
@ -63,6 +63,18 @@ class HttpBrowserTest extends AbstractBrowserTest
|
||||
['POST', 'http://example.com/', [], [], ['CONTENT_TYPE' => 'application/json'], '["content"]'],
|
||||
['POST', 'http://example.com/', ['headers' => $defaultHeaders + ['content-type' => 'application/json'], 'body' => '["content"]', 'max_redirects' => 0]],
|
||||
];
|
||||
yield 'custom header with HTTP_ prefix' => [
|
||||
['PUT', 'http://example.com/', [], [], ['HTTP_CONTENT_TYPE' => 'application/json'], '["content"]'],
|
||||
['PUT', 'http://example.com/', ['headers' => $defaultHeaders + ['content-type' => 'application/json'], 'body' => '["content"]', 'max_redirects' => 0]],
|
||||
];
|
||||
yield 'modify notation of custom header with HTTP_ prefix' => [
|
||||
['PUT', 'http://example.com/', [], [], ['HTTP_Content-Type' => 'application/json'], '["content"]'],
|
||||
['PUT', 'http://example.com/', ['headers' => $defaultHeaders + ['content-type' => 'application/json'], 'body' => '["content"]', 'max_redirects' => 0]],
|
||||
];
|
||||
yield 'modify notation of custom header' => [
|
||||
['PUT', 'http://example.com/', [], [], ['Content-Type' => 'application/json'], '["content"]'],
|
||||
['PUT', 'http://example.com/', ['headers' => $defaultHeaders + ['content-type' => 'application/json'], 'body' => '["content"]', 'max_redirects' => 0]],
|
||||
];
|
||||
}
|
||||
|
||||
public function testMultiPartRequestWithSingleFile()
|
||||
|
@ -73,7 +73,7 @@ class ResolveInstanceofConditionalsPass implements CompilerPassInterface
|
||||
$parent = $definition instanceof ChildDefinition ? $definition->getParent() : null;
|
||||
|
||||
foreach ($conditionals as $interface => $instanceofDefs) {
|
||||
if ($interface !== $class && !(null === $reflectionClass ? $reflectionClass = ($container->getReflectionClass($class, false) ?: false) : $reflectionClass)) {
|
||||
if ($interface !== $class && !($reflectionClass ?? $reflectionClass = $container->getReflectionClass($class, false) ?: false)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -132,6 +132,10 @@ class ResizeFormListener implements EventSubscriberInterface
|
||||
$previousData = $form->getData();
|
||||
/** @var FormInterface $child */
|
||||
foreach ($form as $name => $child) {
|
||||
if (!$child->isValid() || !$child->isSynchronized()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$isNew = !isset($previousData[$name]);
|
||||
$isEmpty = \is_callable($this->deleteEmpty) ? ($this->deleteEmpty)($child->getData()) : $child->isEmpty();
|
||||
|
||||
|
@ -14,6 +14,126 @@
|
||||
<source>The CSRF token is invalid. Please try to resubmit the form.</source>
|
||||
<target>CSRF արժեքը անթույլատրելի է. Փորձեք նորից ուղարկել ձևը։</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="99">
|
||||
<source>This value is not a valid HTML5 color.</source>
|
||||
<target>Այս արժեքը վավեր HTML5 գույն չէ։</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="100">
|
||||
<source>Please enter a valid birthdate.</source>
|
||||
<target>Խնդրում ենք մուտքագրել վավեր ծննդյան ամսաթիվ։</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="101">
|
||||
<source>The selected choice is invalid.</source>
|
||||
<target>Ընտրված ընտրությունն անվավեր է։</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="102">
|
||||
<source>The collection is invalid.</source>
|
||||
<target>Համախումբն անվավեր է։</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="103">
|
||||
<source>Please select a valid color.</source>
|
||||
<target>Խնդրում ենք ընտրել վավեր գույն։</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="104">
|
||||
<source>Please select a valid country.</source>
|
||||
<target>Խնդրում ենք ընտրել վավեր երկիր։</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="105">
|
||||
<source>Please select a valid currency.</source>
|
||||
<target>Խնդրում ենք ընտրել վավեր արժույթ։</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="106">
|
||||
<source>Please choose a valid date interval.</source>
|
||||
<target>Խնդրում ենք ընտրել ճիշտ ամսաթվերի միջակայք։</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="107">
|
||||
<source>Please enter a valid date and time.</source>
|
||||
<target>Խնդրում ենք մուտքագրել վավեր ամսաթիվ և ժամ։</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="108">
|
||||
<source>Please enter a valid date.</source>
|
||||
<target>Խնդրում ենք մուտքագրել վավեր ամսաթիվ։</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="109">
|
||||
<source>Please select a valid file.</source>
|
||||
<target>Խնդրում ենք ընտրել վավեր ֆայլ։</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="110">
|
||||
<source>The hidden field is invalid.</source>
|
||||
<target>Թաքնված դաշտը անվավեր է։</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="111">
|
||||
<source>Please enter an integer.</source>
|
||||
<target>Խնդրում ենք մուտքագրել ամբողջ թիվ։</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="112">
|
||||
<source>Please select a valid language.</source>
|
||||
<target>Խնդրում ենք ընտրել վավեր լեզու։</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="113">
|
||||
<source>Please select a valid locale.</source>
|
||||
<target>Խնդրում ենք ընտրել վավեր տեղայնացում։</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="114">
|
||||
<source>Please enter a valid money amount.</source>
|
||||
<target>Խնդրում ենք մուտքագրել վավեր գումար։</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="115">
|
||||
<source>Please enter a number.</source>
|
||||
<target>Խնդրում ենք մուտքագրել համար։</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="116">
|
||||
<source>The password is invalid.</source>
|
||||
<target>Գաղտնաբառն անվավեր է։</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="117">
|
||||
<source>Please enter a percentage value.</source>
|
||||
<target>Խնդրում ենք մուտքագրել տոկոսային արժեք։</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="118">
|
||||
<source>The values do not match.</source>
|
||||
<target>Արժեքները չեն համընկնում։</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="119">
|
||||
<source>Please enter a valid time.</source>
|
||||
<target>Մուտքագրեք վավեր ժամանակ։</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="120">
|
||||
<source>Please select a valid timezone.</source>
|
||||
<target>Խնդրում ենք ընտրել վավեր ժամային գոտի։</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="121">
|
||||
<source>Please enter a valid URL.</source>
|
||||
<target>Խնդրում ենք մուտքագրել վավեր URL։</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="122">
|
||||
<source>Please enter a valid search term.</source>
|
||||
<target>Խնդրում ենք մուտքագրել վավեր որոնման տերմին։</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="123">
|
||||
<source>Please provide a valid phone number.</source>
|
||||
<target>Խնդրում ենք տրամադրել վավեր հեռախոսահամար։</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="124">
|
||||
<source>The checkbox has an invalid value.</source>
|
||||
<target>Նշման վանդակը անվավեր արժեք ունի։</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="125">
|
||||
<source>Please enter a valid email address.</source>
|
||||
<target>Խնդրում ենք մուտքագրել վավեր էլ-հասցե։</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="126">
|
||||
<source>Please select a valid option.</source>
|
||||
<target>Խնդրում ենք ընտրել ճիշտ տարբերակ։</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="127">
|
||||
<source>Please select a valid range.</source>
|
||||
<target>Խնդրում ենք ընտրել վավեր տիրույթ։</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="128">
|
||||
<source>Please enter a valid week.</source>
|
||||
<target>Մուտքագրեք վավեր շաբաթ։</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
||||
|
@ -255,7 +255,7 @@ class ResizeFormListenerTest extends TestCase
|
||||
|
||||
$data = [0 => 'first', 1 => ''];
|
||||
foreach ($data as $child => $dat) {
|
||||
$this->form->get($child)->setData($dat);
|
||||
$this->form->get($child)->submit($dat);
|
||||
}
|
||||
$event = new FormEvent($this->form, $data);
|
||||
$listener = new ResizeFormListener('text', [], false, true, true);
|
||||
@ -282,11 +282,11 @@ class ResizeFormListenerTest extends TestCase
|
||||
|
||||
$data = ['0' => ['name' => 'John'], '1' => ['name' => '']];
|
||||
foreach ($data as $child => $dat) {
|
||||
$this->form->get($child)->setData($dat);
|
||||
$this->form->get($child)->submit($dat);
|
||||
}
|
||||
$event = new FormEvent($this->form, $data);
|
||||
$callback = function ($data) {
|
||||
return '' === $data['name'];
|
||||
return null === $data['name'];
|
||||
};
|
||||
$listener = new ResizeFormListener('text', [], false, true, $callback);
|
||||
$listener->onSubmit($event);
|
||||
|
@ -12,6 +12,7 @@
|
||||
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
|
||||
|
||||
use Symfony\Component\Form\Exception\UnexpectedTypeException;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\Form;
|
||||
use Symfony\Component\Form\Tests\Fixtures\Author;
|
||||
use Symfony\Component\Form\Tests\Fixtures\AuthorType;
|
||||
@ -212,6 +213,28 @@ class CollectionTypeTest extends BaseTypeTest
|
||||
$this->assertEquals([new Author('s_first', 's_last')], $form->getData());
|
||||
}
|
||||
|
||||
public function testNotDeleteEmptyIfInvalid()
|
||||
{
|
||||
$form = $this->factory->create(static::TESTED_TYPE, null, [
|
||||
'entry_type' => ChoiceType::class,
|
||||
'entry_options' => [
|
||||
'choices' => ['a', 'b'],
|
||||
],
|
||||
'allow_add' => true,
|
||||
'allow_delete' => true,
|
||||
'delete_empty' => true,
|
||||
]);
|
||||
|
||||
$form->submit(['a', 'x', '']);
|
||||
|
||||
$this->assertSame(['a'], $form->getData());
|
||||
$this->assertCount(2, $form);
|
||||
$this->assertTrue($form->has('1'));
|
||||
$this->assertFalse($form[1]->isValid());
|
||||
$this->assertNull($form[1]->getData());
|
||||
$this->assertSame('x', $form[1]->getViewData());
|
||||
}
|
||||
|
||||
public function testNotResizedIfSubmittedWithExtraData()
|
||||
{
|
||||
$form = $this->factory->create(static::TESTED_TYPE, null, [
|
||||
|
Reference in New Issue
Block a user