Finite icon indicating copy to clipboard operation
Finite copied to clipboard

Multiple-graph example doesn't work

Open willemo opened this issue 8 years ago • 1 comments

Update:

It wasn't my callback that broke the example, the example doesn't work out of the box. So now my question is: how do I get multiple graphs to work?

Old question:

When I add a simple callback to the multiple-graph example, an exception gets thrown because the object doesn't comply with the StatefulInterface.

To test I changed the payment loader and added this callback:

'callbacks' => [
    'before' => [
        [
            'do' => function(Finite\StatefulInterface $document, Finite\Event\TransitionEvent $e) {
                echo sprintf(
                    "Applying transition \"%s\"\n",
                    $e->getTransition()->getName()
                );
            }
        ],
    ],
],

The resulting exception is:

PHP Fatal error:  Uncaught exception
'Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException'
with message 'Neither the property "finiteState" nor one of the methods
"getFiniteState()", "finiteState()", "isFiniteState()", "hasFiniteState()", "__get()"
exist and have public access in class "Order".'
in vendor/symfony/property-access/PropertyAccessor.php:487

I tried removing the type constraints of the callback, but that didn't help. Any idea how I can get callbacks to work when my object has a different property path?

willemo avatar Jun 22 '16 14:06 willemo

I created a possible bugfix: #123

willemo avatar Jun 23 '16 08:06 willemo