raoul2000 / yii2-workflow

A simple workflow engine for Yii2
BSD 3-Clause "New" or "Revised" License
171 stars 48 forks source link

keep status updated problem (not an issue, just desperate for your help) #57

Closed lindomarcv closed 4 years ago

lindomarcv commented 5 years ago

Hi, before all thanks for this extension. You did great job. I am having some problem with the status current id. Every time i save the model and start the workflow, things goes ok, but when i try the sendToStatus to make a second transition, it doesn't recognize the last initial status and asks for it again. What i am missing from your guide, here? Best regards

raoul2000 commented 4 years ago

Hi @lindomarcv, Thanks for your nice words Just to be sure, did you notice that sendToStatus doesn't save the model, but does perform the transitions ? Did you check this example from the documentation ?

Ok if you did, then I would need a way to reproduce the behavior you are describing. Is it something like :

$m = new Post();
$m->status = "post/A";
$m->save();

$m->sendToStatus("post/B"); // ERROR here !!

assuming a transition exist between post/A and post/b of course

Is it what you are experiencing ? ciao :sunglasses:

lindomarcv commented 4 years ago

Hi, my problem i think was on the initStatus() i was not calling after Find Model. So every time i was trying a transition i was getting a null from the getWorkflowStatus(). Thank U very much for your reply. Best regards

raoul2000 commented 4 years ago

Glad to hear you could solve the issue 👍