yohang / Finite

A Simple PHP Finite State Machine

Home Page:http://yohan.giarel.li/Finite

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Warning and unexpected behaviour after rejecting a transaction

titomiguelcosta opened this issue · comments

Only today I came across this library, after a few hours of study and running a few examples, I came across the following:

  • Warning if I do not pass a guard option when defining a transition: PHP Notice: Undefined index: guard in vendor/yohang/finite/src/Finite/Loader/ArrayLoader.php on line 109. I did not see any reference of this property in the examples.
  • I was expecting that by calling the method reject() on the TransitionEvent, this would abort the transition, but not the case, it seems it has no impact. The method apply() on StateMachine, after dispatching the pre events, call process() on the Transition, but that method has an empty body, it does not return any value, but still, we use that as the return value of the apply(). Is this by design, are we suppose to create/extend the Transition class and implement our logic in the process method()?

The guard was optional till this PR: #73

I am currently researching about this because I was implementing this state machine without guards and now it seems like it must be included.

this problem is solved on master...is related to the OptionResolver component version 2.6

commented

Can someone please give a hint to me? I'm hitting this error as well but I can't figure out what this "guard" thing is that blows up.
Do I just need to use the current master or is the release 1.0.3 also a fixed release?
I'm using symfony2.6.*

commented

Got a step forward using this:

"yohang/finite": "dev-master",
"alom/graphviz": "~1.0.1",
"kphoen/doctrine-state-machine-bundle": "dev-master",

Now the guard is silent :-)

1.0 won't use Symfony 2.6, but I'll release 1.1.0 this week. Can you confirm that the problem is gone with the current master (1.1) ?

Fixed in #76