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

Paginator class depends on internal state #853

Open
piotrkreft opened this issue May 24, 2021 · 1 comment
Open

Paginator class depends on internal state #853

piotrkreft opened this issue May 24, 2021 · 1 comment

Comments

@piotrkreft
Copy link
Contributor

Q A
Bug report? yes
Feature request? yes
BC Break report? no
RFC? no
Version/Branch 0.13

Class Overblog\GraphQLBundle\Relay\Connection\Paginator depends on internal totalCount state, if fetched already. I find this to be sort of an antipattern in several situations, especially when dealing with DI and class being a service as it brings an additional potential place of failure being harder to find in simple tests even.

Would you consider a change? If yes I'd obviously provide a suitable code for it.
If BC desired the solution could be configurable behavior via an optional constructor parameter though not sure whether it's a good practice tbh. Alternatively, an interface and cache decorator would be more suitable perhaps.

Best regards

@piotrkreft
Copy link
Contributor Author

piotrkreft commented May 29, 2021

As a suggested #855 solution I decided to go with a fully compatible approach and ready out-of-the-box cache callable.
Callable implements ResetInterface so it does grant the developer a possibility to reset cache state and also will be reused by Symfony HTTPKernel if used as service to be reset per request - desired if for an instance one would user DI service and long running process like Roadrunner etc.

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

1 participant