42coders / workflows

The Workflow Package add Drag & Drop Workflows to your Laravel Application.
https://workflows.42coders.com
MIT License
253 stars 66 forks source link

null given when starting a workflow #22

Closed MCKLtech closed 2 years ago

MCKLtech commented 2 years ago

I've set up a basic observer workflow on the User model to trigger when it is updating. I trigger the update by modifying in Nova, similar to the demo video in the README.

It seems in the start() method of the Trigger, the $this->workflow variable is null:

the42coders\Workflows\Triggers;

$log = WorkflowLog::createHelper($this->workflow, $model, $this);

Digging into the database, it seems the trigger is referencing the wrong workflow_id (In my case, it was referencing a deleted Workflow (ID: 3) when it should have been referencing the only Workflow in the system (ID: 6) Therefore, this worked:

$log = WorkflowLog::createHelper(Workflow::find(6), $model, $this);

And the queue ran as expected.

My assumption is that the Workflow model needs a cascading delete?

Max-Hutschenreiter commented 2 years ago

I will have a look tomorrow thanks for reporting

Max-Hutschenreiter commented 2 years ago

Fixed with 0.0.12 (new composer relation added to the package)