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

[Bug]: Import failures are empty when using ShouldQueue #4193

Closed
1 task done
sabina1997 opened this issue Aug 31, 2024 · 1 comment
Closed
1 task done

[Bug]: Import failures are empty when using ShouldQueue #4193

sabina1997 opened this issue Aug 31, 2024 · 1 comment

Comments

@sabina1997
Copy link

Is the bug applicable and reproducable to the latest version of the package and hasn't it been reported before?

  • Yes, it's still reproducable

What version of Laravel Excel are you using?

3.1.56

What version of Laravel are you using?

9.52.16

What version of PHP are you using?

8.1

Describe your issue

I have an import which uses ShouldQueue together with chunk reading and batch inserts.
I want to get all the failures at AfterImport and save on database but the failures are empty. If I remove ShouldQueue its working ok.

How can the issue be reproduced?

Create an import that implements ShouldQueue, try to get the failures at AfterImport event.


class MembersDataImport implements ShouldQueue, SkipsEmptyRows, SkipsOnFailure, ToCollection, WithBatchInserts, WithChunkReading, WithEvents, WithHeadingRow, WithValidation
{
   use Importable, SkipsFailures;

............
   
  public function registerEvents(): array
    {
        return [
            AfterImport::class => function (AfterImport $afterImport) {
                if ($this->failures()
                    ->isNotEmpty()) {
                     $this->storeFailures($this->failures());
                }
            },
        ];
    }
  public function chunkSize(): int
    {
        return 1000;
    }

  public function batchSize(): int
    {
        return 1000;
    }
}

What should be the expected behaviour?

The failures should not be empty if the file has validation errors.

@sabina1997 sabina1997 added the bug label Aug 31, 2024
@stale stale bot added the stale label Nov 7, 2024
Copy link

stale bot commented Nov 9, 2024

This bug report has been automatically closed because it has not had recent activity. If this is still an active bug, please comment to reopen. Thank you for your contributions.

@stale stale bot closed this as completed Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant