Doctrine 2: Query result as associative array

前端 未结 5 1395
傲寒
傲寒 2020-12-29 05:58

In my Repository class I use the following code to query:

$query = $this->getEntityManager()->createQuery(\"
    SELECT s.term, COUNT(s.term) AS freq
          


        
5条回答
  •  时光说笑
    2020-12-29 06:39

    Actually somewhere the transposition has to be done. See Hydration Modes about what is returned by ->getResult() and which alternatives modes/variants already exist.

    You can also add your own hydration mode at a central place. That is explained in Custom Hydration Modes.

提交回复
热议问题