Closed tomchkk closed 6 years ago
You're right that it's only an estimation while determining the final value. And you're also right that it's meant to avoid executing the rest of the function when it's not relevant yet within the current progress of the flow. But it's also useful to avoid accessing invalid (or not yet given) data.
In the demo code you mentioned, the category (e.g. if it's a bug report) is set in step 1, so calling $flow->getFormData()->isBugReport()
would only make sense when step 1 is done already. The goal is to only enable step 3 if the category has been set to "bug report" in step 1.
Thanks, @craue, for explaining that.
I'd like to better understand the purpose of the
$estimatedCurrentStepNumber
variable given to askip
option callable inFormFlow::loadStepsConfig()
. It isn't explained throughly in the documentation and, after some research, I can't say I really see the point of it.The docs mention it briefly and exemplify it as follows:
From this example I infer that it's purpose - in this case - is to ensure that the step is only actually evaluated for skipping at the correct occurrence - i.e.: when the current step is not step 1 or, more generally, when the current step is not the previous step. My thought process is as follows:
But then, referring to the CraueFormFlowBundle Demo and its source code, the
skip
config for CreateTopicFlow disproves my theory because, on line 37, theskip
function forstep 3
also tests the$estimatedCurrentStepNumber
against1
- i.e.:I realise that the
$estimatedCurrentStepNumber
variable name itself tells me that its value is an estimation, but in my testing I cannot find any predictable correlation between this variable's value and the actual current step value. Because of this, in my current project, I tried not using$estimatedCurrentStepNumber
at all in myskip
callables, and I cannot see any differences to the correctness of myflow
implementation.So it appears to me that testing the value of
$estimatedCurrentStepNumber
doesn't really serve any purpose at all. I would be very interested to learn otherwise though.Thanks