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

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

Open
stevebauman opened this issue Feb 29, 2024 · 0 comments

Comments

@stevebauman
Copy link
Collaborator

stevebauman commented Feb 29, 2024

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():

private function mapDependencies(array $dependencies): array
{
$result = [];
foreach ($dependencies as $dependency) {
if (\is_string($dependency)) {
$dependency = new StaticDependency($dependency);
}
$result[] = $dependency;
}
return $result;
}

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?

  • Allow integer dependencies
  • Throw an exception if this is attempted
  • Cast job IDs to a string if it is an integer
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

1 participant