Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BC break between 1.1.0 and 1.1.1 with custom property_path #138

Open
Gregoire-M opened this issue Feb 23, 2018 · 2 comments
Open

BC break between 1.1.0 and 1.1.1 with custom property_path #138

Gregoire-M opened this issue Feb 23, 2018 · 2 comments

Comments

@Gregoire-M
Copy link

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 c7a5672

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();
Gregoire-M referenced this issue Feb 23, 2018
added test for array loader with custom state accessor
@Gregoire-M
Copy link
Author

Gregoire-M commented Feb 23, 2018

Ho, it was actually already reported in #117 / #118

@func0der
Copy link

Since this is not only a BC break, but renders the ArrayLoaders 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants