Answer the question
In order to leave comments, you need to log in
Is it possible to get data from the database in this form?
Hello everyone, there was such a question, there is a table with two columns "key", "value". The question arose, is it possible to obtain a result of this type when sampling?
array(
'key' => 'value',
'key' => 'value',
'key' => 'value'
)
Answer the question
In order to leave comments, you need to log in
If I understand the problem correctly, then you need to hydrate to the desired format.
Can you indicate the type of hydration $query->getResult(Query::HYDRATE_SCALAR)
?
You can also make a custom hydrator
In general, it's strange that there is an array, there should be an object, maybe Query::HYDRATE_OBJECT
it's by default, you didn't set it by chance Query::HYDRATE_ARRAY
, maybe the code was copied from somewhere with this value?
Delve into the Possibilities: Doctrine 2: Hydration Modes
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question