Finite
Finite copied to clipboard
BC break between 1.1.0 and 1.1.1 with custom property_path
Hi,
When using a custom property_path (I mean different than "finiteState"), there's a BC break when updating from v1.1.0 to v1.1.1, caused by the commit c7a5672377695cdf65cd5f9a3372c18d0f02d7c1
Before the update, I construct my state machine this way:
$config = /* I get my config array... */
$loader = new ArrayLoader($config);
$stateMachine = new StateMachine($object, $this->eventDispatcher);
$loader->load($stateMachine);
$stateMachine->initialize();
$config['property_path']
is set to a custom path. ArrayLoader::load constructs a PropertyPathStateAccessor with this property. Everything works fine.
After the update to v1.1.1, when I construct my state machine the same way, a default PropertyPathStateAccessor is constructed in ArrayLoader's constructor. So ArrayLoader::load sees that a state accessor is set, so it does not constructs a new one with the configured property path.
So the state machine doesn't have the right property path.
To fix this, I have to change the way I construct my state machine, as follows:
$config = /* I get my config array... */
$loader = new ArrayLoader($config);
$stateMachine = new StateMachine(
$object,
$this->eventDispatcher,
isset($config['property_path']) ? new PropertyPathStateAccessor($config['property_path']) : null
);
$loader->load($stateMachine);
$stateMachine->initialize();
Ho, it was actually already reported in #117 / #118
Since this is not only a BC break, but renders the ArrayLoader
s functionality unusable for the property_path
, this library should be considered broken and abandon-ware.
Please mark it as such @yohang . There is no shame in it.