Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugs when modding multiple times with multiple #677

Open
ukeloop opened this issue Mar 14, 2022 · 2 comments
Open

Bugs when modding multiple times with multiple #677

ukeloop opened this issue Mar 14, 2022 · 2 comments

Comments

@ukeloop
Copy link
Contributor

ukeloop commented Mar 14, 2022

Bugs when modding multiple times with multiple.

#305 related bugs.

$options = [
    'choices' => ['en' => 'English', 'fr' => 'French'],
    'choice_options' => [
        'wrapper' => ['class' => 'choice-wrapper'],
        'label_attr' => ['class' => 'label-class'],
    ],
    'expanded' => true,
    'multiple' => true
];

$this->plainForm->add('test', 'choice', $options);

echo $this->plainForm->test->getName(); // test
var_dump($this->plainForm->test->getOption('tmp.multipleBracesSet')); // Null

$this->plainForm->modify('test', 'choice', [
    'rules' => 'required',
]);

echo $this->plainForm->test->getName(); // test[]
var_dump($this->plainForm->test->getOption('tmp.multipleBracesSet')); // true

$this->plainForm->modify('test', 'choice', [
    'rules' => 'required',
]);

echo $this->plainForm->test->getName(); // test
var_dump($this->plainForm->test->getOption('tmp.multipleBracesSet')); // true

I think codes of modding name should move to render method and remove side effects.

if ($this->getOption('attr.multiple') && !$this->getOption('tmp.multipleBracesSet')) {
$this->name = $this->name . '[]';
$this->setOption('tmp.multipleBracesSet', true);
}

@rudiedirkx
Copy link
Collaborator

The choice type is broken is several ways. All ParentType fields are somewhat broken. I'm starting v2 without it.

@Eloar
Copy link
Contributor

Eloar commented Apr 13, 2023

I have feeling #705 might resolve that issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants