Doctrine entity object to array

前端 未结 8 675
星月不相逢
星月不相逢 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条回答
  •  一向
    一向 (楼主)
    2020-12-16 13:55

    If you just need to access a single value, you can also do this...

    If 'personType' were an object and you wanted the value of the relationship...

    $personTypeId = $form->get('personType')->getViewData();
    

提交回复
热议问题