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

ValidatorStep | Can't set option for Constraint Collection allowExtraFields #302

Open
kyleobrien91 opened this issue Jun 12, 2016 · 6 comments

Comments

@kyleobrien91
Copy link

kyleobrien91 commented Jun 12, 2016

Can't currently set flag in ValidatorStep to ignore extra fields in $item object when validating.

@Baachi @ddeboer @sagikazarmark - is this something I can achieve someway else? Otherwise, can I go ahead and create a PR for this?

@Baachi
Copy link
Collaborator

Baachi commented Jun 13, 2016

If you deactivate the strict mode, the validator will only validate the fields which have an constraint.

@kyleobrien91 kyleobrien91 changed the title ValidatorStep | Can't set option for Constract Collection allowExtraFields ValidatorStep | Can't set option for Constraint Collection allowExtraFields Jun 13, 2016
@kyleobrien91
Copy link
Author

kyleobrien91 commented Jun 13, 2016

@Baachi - there is no setStrict on the ValidatorStep class. There is one on the ValidatorFilter but since the Workflow doesn't seem to be a concretion anymore, I can only use steps that implement PriorityStep - whilst my old 'Workflow' object is now a StepAggregator.

Which means I only have ValidatorStep available to me - which doesn't seem to have a setStrict method

https://github.com/ddeboer/data-import/blob/master/src/Step/ValidatorStep.php

@kyleobrien91
Copy link
Author

kyleobrien91 commented Jun 14, 2016

@Baachi - if I implement the isStrict logic in ValidatorStep as it's done on ValidatorFilter, then setting isStrict(false) works great. Should I push a PR for this or is there a reason this was excluded from ValidatorStep in 0.19.0?

@Baachi
Copy link
Collaborator

Baachi commented Jun 14, 2016

Not in the step, but in the ValidatorFilter.

Feel free to open a PR, to implement that feature in the ValidatorStep.

@kyleobrien91
Copy link
Author

Thanks @Baachi. One thing - I'm unsure how ValidatorFilter features in the new Workflow. In 0.18 we had a concrete Workflow class. That class had addFilter. However, in 0.19.0, the Workflow class is no longer a concretion. It is now an interface with a single item in the contract that StepAggregator now implements.

StepAggregator itself does not have an addFilter method so it doesn't seem I'm able to leverage the ValidatorFilter in the context of StepAggregator. Further, the filters can't be added as a step because they don't adhere to the Step contract/interface.

Thus, at least, on my first glance, I don't see a way to fit the filters into the "workflow" (ie StepAggregator).

Make sense? Or am I missing something more fundamental in the change from 0.18 to 0.19?

@IvBre
Copy link

IvBre commented Sep 21, 2016

HI @kyleobrien91 and @Baachi I've created a pull request with this option included, can you please take a look: #311

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