laravel-workflow icon indicating copy to clipboard operation
laravel-workflow copied to clipboard

Argument Error - Argument 1 passed to Symfony\\Component\\Workflow\\Marking::__construct() must be of the type array, string given

Open Kreateyou opened this issue 5 years ago • 7 comments

I am getting the following error

Argument 1 passed to Symfony\Component\Workflow\Marking::__construct() must be of the type array, string given, called in vendor/symfony/workflow/MarkingStore/MultipleStateMarkingStore.php on line 47

Kreateyou avatar Jan 18 '20 03:01 Kreateyou

Hi Can you please provide sample code?

brexis avatar Jan 18 '20 03:01 brexis

Seem the error is thrown when i use any WorkflowTrai method workflow_can(),workflow_apply()

$model = Post::find(1);

$model->workflow_apply($request->get("workflow"));

$model->save();

Where request workflow is "to_review"

Kreateyou avatar Jan 18 '20 03:01 Kreateyou

Can you please add:

  • Your PHP version
  • Your Laravel Version

I'm not able to reproduce this, and it will help a lot for debugging.

brexis avatar Jan 29 '20 13:01 brexis

Can you please add:

  • Your PHP version
  • Your Laravel Version

I'm not able to reproduce this, and it will help a lot for debugging.

Thank Brexis for reply

i am using PHP 7.2 and Lumen (6.2.0) (Laravel Components ^6.0)

Kreateyou avatar Jan 30 '20 06:01 Kreateyou

hey @brexis, facing same issue, please update ASAP PHP - 7.3 laravel 5.8

pavan-cs avatar Feb 03 '20 12:02 pavan-cs

@Kreateyou and @brexis

in workflow.php (config)

'marking_store' => [
            'type' => 'single_state', // 'multiple_state',
            'arguments' => ['status'],
        ],

fixed my issue, but you need to fix this issue :)

pavan-cs avatar Feb 03 '20 13:02 pavan-cs

Hello, I had the same error message with the multiple_state type (not with single_state) To solve it with the multiple_state, you have to specify the field of your argument in your model like this :

protected $casts = [
    'status' => 'array'
];

Fabien

fabien44300 avatar Feb 27 '20 07:02 fabien44300