You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
What version of Laravel are you using?
10.10
What version of PHP are you using?
8.2
Describe your issue
When I use generator with lazy model query. it gives some duplicate rows instead real rows. the count of rows is equal with real ones but real rows is lost and some rows become duplicate.
class ListExportGenerator implements FromGenerator, WithHeadings, ShouldAutoSize
{
use Exportable;
protected $query;
public function __construct($query)
{
$this->query = $query;
}
public function generator(): Generator
{
foreach ($this->query->lazy(200) as $item) {
yield [
$createdAt,
$updatedAt,
$this->getStatus(intval($item["status"] ?? "")),
];
}
}
public function headings(): array
{
return [
'Дата создания',
'Дата изменения',
'Статус',
];
}
protected function getStatus($status): string
{
return match ($status) {
default => "Не активный",
};
}
}
```__
### How can the issue be reproduced?
I use yield with generator.
### What should be the expected behaviour?
It must contain real rows, not duplicate.
The text was updated successfully, but these errors were encountered:
Why not just use FromQuery + WithMapping, it does the same as your example?
Because FromQuery, although it chunks the jobs according to the query's count (AppendQueryToSheet), Close Sheet is not optimised / adjusted for that use, leading to memory allocation exhaustion.
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.
Is the bug applicable and reproducable to the latest version of the package and hasn't it been reported before?
What version of Laravel Excel are you using?
3.1
What version of Laravel are you using?
10.10
What version of PHP are you using?
8.2
Describe your issue
When I use generator with lazy model query. it gives some duplicate rows instead real rows. the count of rows is equal with real ones but real rows is lost and some rows become duplicate.
The text was updated successfully, but these errors were encountered: