mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Second level cache does not support scalar results. #7188
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @konmedia-devops on GitHub (Jul 27, 2023).
I'm not sure if I have a different problem than discussed in #6627 or if it's a new topic. If I use the Querybuilder to create a query that adds the selects individually (because functions still have to be used in the select > AES_DECRYPT), I get the error message mentioned.
I map the content as an object directly to the entity with \Doctrine\ORM\AbstractQuery::HYDRATE_OBJECT
This only seems to work if you do the following:
It doesn't work when I do it like this:
The same structure (also internally) suddenly brings an error:
Second level cache does not support scalar results.
Do you have a tip what's wrong here? Thank you.
@derrabus commented on GitHub (Jul 27, 2023):
I don't have a solution to your cache problem, but looking at your code I wonder if you really need that custom query if what you actually want is to hydrate an entity. Shouldn't it be possible to achieve the same thing with a custom DBAL type for your encrypted columns?
@konmedia-devops commented on GitHub (Jul 28, 2023):
Thank you for your reply.
We had a solution with Types a few years ago. This works conditionally, depending on whether a further transformation of the data is added. We already use the types for other transformation aspects and would now have to create combinations associated with the encryption. I will validate that again. Anyway, thanks for the hint.
However, I now notice that when using the second code block without 2nd-lc, the hydration no longer works. In some cases, I no longer get an object, but an array. Is that an indication of the underlying problem?
I would like to understand why my code behaves this way. I've already debugged and can't get to the point that ensures that scalars are used. Can you name code reference? Just for understanding...