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

DataObjectBatchListing ignores ->setOffset() #2714

Closed
hethehe opened this issue Sep 16, 2024 · 8 comments
Closed

DataObjectBatchListing ignores ->setOffset() #2714

hethehe opened this issue Sep 16, 2024 · 8 comments

Comments

@hethehe
Copy link
Contributor

hethehe commented Sep 16, 2024

Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no

If we create a Listing and set a offset with $listing->setOffset(100) and use it with the CoreShop\Component\Pimcore\BatchProcessing\DataObjectBatchListing it gets ignored.

I think the problem is that you get the loadIdList() and the getTotalCount() from the DAO instead directly from the $list

Is there a special reason you use the $dao instead the $list directly?

@dpfaffenbauer
Copy link
Member

@hethehe honestly, not sure... we never actually had in mind that the BatchList can use a offset :D.

@hethehe
Copy link
Contributor Author

hethehe commented Sep 16, 2024

@dpfaffenbauer We tried to set an offset for the coreshop:index command, as sometimes it would be nice not to include all products ;)

Are you interested in a PR that changes the $dao to $list? I don't see anything that could break, WDYT?

@dpfaffenbauer
Copy link
Member

dpfaffenbauer commented Sep 16, 2024

@hethehe yes, we are interested. it should be tested anyway, maybe you can add another test for offests?

@hethehe
Copy link
Contributor Author

hethehe commented Sep 16, 2024

Just realized, that this is not a problem of your BatchListing but from Pimcore's getTotalCount()
see: pimcore/pimcore#17618

@dpfaffenbauer
Copy link
Member

gotcha, then we can close this?

@hethehe
Copy link
Contributor Author

hethehe commented Sep 16, 2024

yes, closed

@hethehe hethehe closed this as completed Sep 16, 2024
@kingjia90
Copy link

kingjia90 commented Sep 16, 2024

Can this issue be opened again please?
I believe the initial issue would be fixed if we replace getTotalCount() to getCount() in there

if (!method_exists($dao, 'getTotalCount')) {
throw new \InvalidArgumentException(sprintf(
'%s listing class does not support count.',
$this->list::class,
));
}
/** @psalm-suppress InternalMethod */
$this->total = $dao->getTotalCount();

see also pimcore/pimcore#17618 (comment)

@dpfaffenbauer dpfaffenbauer reopened this Sep 16, 2024
@dpfaffenbauer
Copy link
Member

@hethehe can you give it a test?

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

No branches or pull requests

3 participants