contributte / forms-multiplier

:repeat: Form multiplier & replicator for Nette Framework

Home Page:https://contributte.org/packages/contributte/forms-multiplier.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue with the input type returned from multiplier since d51e6d4fb1d05fa01a6c2e1cb6d6f150c4e7e756

jakubvojacek opened this issue · comments

Hello

we were using master#d51e6d4fb1d05fa01a6c2e1cb6d6f150c4e7e756 without problems, today, after upgrading to 3.2.0, multiplier started to return integers as strings (when there is an integer input added via $form->addInteger). I quickly looked at the code but did not find the place where this bug was introduced.

Can you please check?

Thank you
Jakub

Hi, please provide some code or better failing tests to reproduce it. Thanks.

I did some digging and it was actually commit 45ed76a, method validate (45ed76a#diff-bbd929c6f77fe505e5255934192003ffef1ca43d2ecd1b908083449269892acaR206)

by changing line

$controls = $controls ?? iterator_to_array($this->getComponents(false, Control::class));

to

$controls = $controls ?? iterator_to_array($this->getComponents(true, Control::class));

or 

$controls = $controls ?? iterator_to_array($this->getComponents());

it starts to work as expected

Could you please send a PR? Excellent digging.

certainly, which of the two options I found that work you prefer?

@f3l1x @jakubvojacek

Yeah, I am on the master and I have this problem also.

It was introduced in this commit as mentioned.

45ed76a#diff-bbd929c6f77fe505e5255934192003ffef1ca43d2ecd1b908083449269892acaR206

My comment - I think there should be C variant without parameter as it was.

#69 (review)

Can you guys test dev-master? Thx.

@f3l1x afk, I am going to deploy it on Friday.

@f3l1x all tests passed with dev-master, seems OK, thanks 🙏

Turns out this was because the Multiplier component’s direct subcomponents are actually Containers, the Controls (other than Add Submitter) are nested. I have opened #103 switching to the correct filter.