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

[5.5] definition for Job interface #21532

Closed
wants to merge 1 commit into from

Conversation

Artistan
Copy link
Contributor

@Artistan Artistan commented Oct 4, 2017

defining methods available via @mixin

also "patch" for 5.5 to show that getJobId() is standard, 5.6 includes the methods.

#21298
#21303

@Artistan Artistan changed the title defining/updating for the magic methods. [5.5] defining/updating for the magic methods. Oct 4, 2017
@Artistan Artistan changed the title [5.5] defining/updating for the magic methods. [5.5] definition for Job interface Oct 4, 2017
@sisve
Copy link
Contributor

sisve commented Oct 4, 2017

This looks really weird.

Why should the abstract Job class be involved with the interface? What does this give?

The getJobId is documented to return an int, but a majority of the implementations states it returns a string. And in the case of DatabaseJob it requires that the actual job uses the InteractsWithQueue trait or the method will throw an exception.

Should the getJobId really be declared on the interface if not all implementations have a working method implemented out-of-the-box?

@Artistan
Copy link
Contributor Author

Artistan commented Oct 4, 2017

here is my reasoning .

  • every instance in the framework of extends Job has the method
  • I do not see where database will throw exception, it has the method also.
    https://github.com/laravel/framework/blob/5.5/src/Illuminate/Queue/Jobs/DatabaseJob.php#L86
  • based on research I have done, each of those ids should actually be int
  • the interface is what is used in the Jobs created by users
  • without the mixin in the interface/contract there is no definition of or reference to what the job methods actually are
  • this improves readability and navigation for the users tracing the job contract to where the implementation actually is.

this is already implemented for 5.6.

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

Successfully merging this pull request may close these issues.

3 participants