Revert "fix(state): update generic template type variable in ProviderInterface"#7094
Conversation
…Interfac…" This reverts commit c12d3dc.
|
So is this supposed to mean that we're not allowed to return multidimensional arrays from the provider? It's only expected to return an array of objects? Is there a reason for that? Having to built a DTO just to use a provider seems like overkill in some scenarios. Especially if it's not something we need documented. |
|
@nesl247 the processor can return this, working with arrays in a provider makes things more complicated, I'd love to see some use case of using an array |
|
@soyuka with this merged we no longer can return an array without phpstan complaining. Our use case for arrays is data that we return that doesn't have a defined type due to difficulties, came from a third party, is legacy, or came directly from the database (insights) or a combination. In some of these cases we could make a Dto, but it would take a lot of work for no real benefit. It would take a lot less time to add the |
|
Use an stdClass (PDO can also return objects). My concern is that we assume from here: core/src/State/Provider/ReadProvider.php Line 79 in aa20430 That Could you probably create a baseline on your phpstan and just ignore this error? |
|
I know PDO can return objects we just don't prefer to use it that way. And most of what we return isn't directly from the database, it's just a few cases. Is the stance that api platform will only support objects going forward, or that arrays should work too but can't be guaranteed yet, and any issues we find would need to be reported and solved? Asking so it's clear to us what direction to go in. If it's that objects are the only thing that will be supported, it should be made more clear in the documentation. I'm not complaining either way, just asking for clarification. |
Reverts #7083