LdapRecord: [Bug] Query chunking stops after returning the first page of results
Environment:
- LDAP Server Type: ActiveDirectory
- PHP Version: 8.1
Describe the bug:
When I use the chunk
method, the query stops after returning only one page of results. So for the query below, I’d get one page of 500 entries, but nothing more. I’ve tried changing the page size to different values like 10 or 1000, but still only get one page of results back.
use App\Models\Person;
use LdapRecord\Models\ActiveDirectory\Entry;
use LdapRecord\Query\Builder;
Entry::query()
->select([
'cn',
'mail',
])
->where(...)
->where(...)
->orFilter(function (Builder $query) {
$query
->where(...)
->where(...)
->where(...);
})
->chunk(500, function ($entries) {
foreach ($entries as $entry) {
Person::create([
"name" => $entry->getFirstAttribute("cn"),
"email" => $entry->getFirstAttribute("mail"),
]);
}
});
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (9 by maintainers)
Commits related to this issue
- Ensure paginator continues when cookie is zero https://github.com/DirectoryTree/LdapRecord/issues/388 — committed to DirectoryTree/LdapRecord by stevebauman 2 years ago
Still works after the update. Thanks again for your help and for all the work you do on this project. Makes working with LDAP in PHP a breeze 😃.