ksassnowski / venture

Venture allows you to create and manage complex, async workflows in your Laravel apps.
https://laravel-venture.com
MIT License
804 stars 32 forks source link

Unable to add jobs with integer ID's - Call to a member function getID() on int #95

Open stevebauman opened 9 months ago

stevebauman commented 9 months ago

I've discovered that we're not able to add jobs with integer based ID's, as they will not be recognized as a "static dependency" here in mapDependencies():

https://github.com/ksassnowski/venture/blob/73cdd0f05b32f161104d30f4e61c103b16845074/src/WorkflowDefinition.php#L454-L467

To reproduce, add a job with an integer based dependency, then make a job depend on it:

$workflow = $this->define('Some workflow'):

$workflow->addJob(
    job: new SomeJob(),
    id: 1,
);

// throws Exception: Error: Call to a member function getID() on int
$workflow->addJob(
    job: new SomeOtherJob(),
    dependencies: [1],
);

Should we do one of the below?