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

Old options will remain #673

Open
ukeloop opened this issue Mar 5, 2022 · 3 comments
Open

Old options will remain #673

ukeloop opened this issue Mar 5, 2022 · 3 comments

Comments

@ukeloop
Copy link
Contributor

ukeloop commented Mar 5, 2022

If I want to change rules and the number of rules is too small, the old rules will remain.

$form = $this->plain()
    ->add(
        'email',
        'email',
        [
            'rules' => [
                'rule_a',
                'rule_b',
                'rule_c',
            ],
        ],
    );

$form->modify(
    'email',
    'email',
    [
        'rules' => [
            'rule_d',
        ],
    ],
);

Modified rules is

$form->email->getOption('rules');
// [
//     'rule_d',
//     'rule_b',
//     'rule_c',
// ],

But I expect

$form->email->getOption('rules');
// [
//     'rule_d',
// ],
@rudiedirkx
Copy link
Collaborator

It seems that was intentional..? Kinda? See #577 - I'm lost...

@ukeloop
Copy link
Contributor Author

ukeloop commented Mar 6, 2022

I had missed out on that PR. Thanks for letting me know.

However, I think this problem applies to all options of type list, such as choice.

I'm just as eager to make this project better as you are.

Thank.

@rudiedirkx
Copy link
Collaborator

I'm just as eager to make this project better as you are.

We need a few rewrites. No more ParentType (choice) for select/radios/checkboxes, better options merging, better collection value/models, fixing the form field, probably more, lots of BC breaks.

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

2 participants