Doctrine entity object to array

前端 未结 8 674
星月不相逢
星月不相逢 2020-12-16 13:10

Wants to convert doctrine entiry object to normal array, this is my code so far,

 $demo = $this->doctrine->em->find(\'Entity\\User\',2);
         


        
8条回答
  •  -上瘾入骨i
    2020-12-16 14:00

    I'm new to Symfony, but there is some working (but strange) way:

    json_decode($this->container->get('serializer')->serialize($entity, 'json'))

提交回复
热议问题