I have a table "config" with three fields
------------------
id | name | value
------------------
1 | na1 | va1
2 | na2 | va2
3 | na3 | va3
. | ... | ...
I need to fetch the above data to an array "$confData" as given below
$confData ===>
array(
'na1' => 'va1',
'na2' => 'va2',
'na1' => 'va3',
' . ' => '...'
);
I want to know wether there is any predefined function/method in symfony-doctrine to get this array? If it is not available, how can use doctrine way?
There is no such default way. You should build this array manually for fetched object.
//after fetching $objectCollection
$config = array();
foreach ($objectCollection as $object) {
$config[$object->getName()] = $object->getValue();
}