data-import
data-import copied to clipboard
ValidatorStep | Can't set option for Constraint Collection allowExtraFields
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?
If you deactivate the strict mode, the validator will only validate the fields which have an constraint.
@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
@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?
Not in the step, but in the ValidatorFilter.
Feel free to open a PR, to implement that feature in the ValidatorStep
.
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?
HI @kyleobrien91 and @Baachi I've created a pull request with this option included, can you please take a look: https://github.com/ddeboer/data-import/pull/311