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

[8.x] Fixes DatabaseUuidFailedJobProvider::find() job record structure #34251

Merged
merged 1 commit into from
Sep 10, 2020

Conversation

nunomaduro
Copy link
Member

@nunomaduro nunomaduro commented Sep 10, 2020

This pull request may be consider a breaking change or a bug fix. 👍🏻

Looking at the DatabaseUuidFailedJobProvider::all(), this method overrides the job record id by the job record uuid:

public function all()
{
    return $this->getTable()->orderBy('id', 'desc')->get()->map(function ($record) {
        $record->id = $record->uuid; // here
        unset($record->uuid); // here

        return $record;
    })->all();
}

This pull request adds the same behaviour for consistency to the method DatabaseUuidFailedJobProvider::find():

public function find($id)
{
    if ($record = $this->getTable()->where('uuid', $id)->first()) {
        $record->id = $record->uuid; // added this
        unset($record->uuid); // added this
    }

    return $record;
}

Before:

{
  "id": 7
  "uuid": "78ec04ae-3e31-4d7d-9ade-846fff307a71"
  "connection": "database"
  "queue": "default"
  "payload": "{"uuid":"78ec04ae-3e31-4d7d-9ade-846fff307a71", "...

After:

{
  "id": "a0bd8c87-f48f-41ed-9512-3ddbf7d76c23"
  "connection": "database"
  "queue": "default"
  "payload": "{"uuid":"78ec04ae-3e31-4d7d-9ade-846fff307a71", "...

@nunomaduro nunomaduro assigned nunomaduro and unassigned nunomaduro Sep 10, 2020
@taylorotwell taylorotwell merged commit 7b4d0f7 into 8.x Sep 10, 2020
@nunomaduro nunomaduro deleted the fix/find-database-uuids-failed-job-id branch September 10, 2020 12:32
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.

2 participants