我試圖從字段'動作'中從我的數據庫中拉出一個值,它是一個JSON字符串,但是現在我將它存儲爲單個值,這就是:Symfony JSON輸出包括字段名稱
'command'=>'get','target'=>'location'
然而,當我把它從它包含的字段名稱,這是我不希望的DB,見下圖:
[{"action":"'command'=>'get','target'=>'location'"}]
我的代碼是在這裏:
$em = $this->getDoctrine()->getManager();
$query = $em->createQueryBuilder();
$q = $query->select('z.action')
->from('AppBundle:ZeusUsers', 'z')
->where('z.id = ?1')
->setParameter(1, $id)
->getQuery();
$action = $q->getResult();
return new Response(json_encode($action));
所以我只需要知道如何獲取不包含字段名稱的字段值?
似乎並沒有做出區別 – 2015-04-02 19:49:57