0

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?

1 Answer 1

1

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();
}
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.