Skip to content

Bugs when modding multiple times with multiple #677

@ukeloop

Description

@ukeloop

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);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions