<tfoot id='QUu65'></tfoot>

    1. <i id='QUu65'><tr id='QUu65'><dt id='QUu65'><q id='QUu65'><span id='QUu65'><b id='QUu65'><form id='QUu65'><ins id='QUu65'></ins><ul id='QUu65'></ul><sub id='QUu65'></sub></form><legend id='QUu65'></legend><bdo id='QUu65'><pre id='QUu65'><center id='QUu65'></center></pre></bdo></b><th id='QUu65'></th></span></q></dt></tr></i><div id='QUu65'><tfoot id='QUu65'></tfoot><dl id='QUu65'><fieldset id='QUu65'></fieldset></dl></div>

      <legend id='QUu65'><style id='QUu65'><dir id='QUu65'><q id='QUu65'></q></dir></style></legend>

      <small id='QUu65'></small><noframes id='QUu65'>

        <bdo id='QUu65'></bdo><ul id='QUu65'></ul>

      教义实体对象到数组

      时间:2024-08-09

            <i id='HQfla'><tr id='HQfla'><dt id='HQfla'><q id='HQfla'><span id='HQfla'><b id='HQfla'><form id='HQfla'><ins id='HQfla'></ins><ul id='HQfla'></ul><sub id='HQfla'></sub></form><legend id='HQfla'></legend><bdo id='HQfla'><pre id='HQfla'><center id='HQfla'></center></pre></bdo></b><th id='HQfla'></th></span></q></dt></tr></i><div id='HQfla'><tfoot id='HQfla'></tfoot><dl id='HQfla'><fieldset id='HQfla'></fieldset></dl></div>

            <small id='HQfla'></small><noframes id='HQfla'>

            <tfoot id='HQfla'></tfoot>

          1. <legend id='HQfla'><style id='HQfla'><dir id='HQfla'><q id='HQfla'></q></dir></style></legend>
              • <bdo id='HQfla'></bdo><ul id='HQfla'></ul>
                  <tbody id='HQfla'></tbody>
              • 本文介绍了教义实体对象到数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                想要将教义实体转换为普通数组,这是我目前的代码,

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

                 $demo = $this->doctrine->em->find('EntityUser',2);
                

                获取实体对象,

                EntityUser Object
                (
                [id:EntityUser:private] => 2
                [username:EntityUser:private] => TestUser
                [password:EntityUser:private] => 950715f3f83e20ee154995cd5a89ac75
                [email:EntityUser:private] => test@test.com
                [firm_id:EntityUser:private] => EntityFirm Object
                    (
                        [id:EntityFirm:private] => 16
                        [company_name:EntityFirm:private] => TestFirm
                        [company_detail:EntityFirm:private] => India
                        [created_at:EntityFirm:private] => DateTime Object
                            (
                                [date] => 2014-08-01 18:16:08
                                [timezone_type] => 3
                                [timezone] => Europe/Paris
                            )
                
                        [user:EntityFirm:private] => 
                    )
                
                [created_at:EntityUser:private] => DateTime Object
                    (
                        [date] => 2014-08-01 15:12:36
                        [timezone_type] => 3
                        [timezone] => Europe/Paris
                    )
                
                [updated_at:EntityUser:private] => DateTime Object
                    (
                        [date] => 2014-08-01 15:12:36
                        [timezone_type] => 3
                        [timezone] => Europe/Paris
                    )
                
                [firm:protected] => 
                ) ,
                

                试过 这个 ,但根据我的requiremnet,不想使用doctrine_query.谢谢.

                Tried this ,But as per my requiremnet do not want to user doctrine_query. Thanks.

                推荐答案

                你可以试试这样的,

                    $result = $this->em->createQueryBuilder();
                    $app_code = $result->select('p')
                            ->from('YourUserBundle:User', 'p')
                            ->where('p.id= :id')
                            ->setParameter('id', 2)
                            ->getQuery()
                            ->getResult(DoctrineORMQuery::HYDRATE_ARRAY);
                

                另一种方式,

                 $this->em->getRepository('YourUserBundle:User')
                      ->findBy(array('id'=>1));
                

                上面将返回一个数组,但包含教义对象.返回数组的最佳方法是使用教义查询.

                Above will return an array but contains doctrine objects. Best way to return an array is using the doctrine query.

                希望这会有所帮助.干杯!

                Hope this helps. Cheers!

                这篇关于教义实体对象到数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:Doctrine 实体删除 vs 删除查询,性能比较 下一篇:教义2关联未初始化

                相关文章

              • <tfoot id='qiXAr'></tfoot>
                • <bdo id='qiXAr'></bdo><ul id='qiXAr'></ul>
                <i id='qiXAr'><tr id='qiXAr'><dt id='qiXAr'><q id='qiXAr'><span id='qiXAr'><b id='qiXAr'><form id='qiXAr'><ins id='qiXAr'></ins><ul id='qiXAr'></ul><sub id='qiXAr'></sub></form><legend id='qiXAr'></legend><bdo id='qiXAr'><pre id='qiXAr'><center id='qiXAr'></center></pre></bdo></b><th id='qiXAr'></th></span></q></dt></tr></i><div id='qiXAr'><tfoot id='qiXAr'></tfoot><dl id='qiXAr'><fieldset id='qiXAr'></fieldset></dl></div>

                  <legend id='qiXAr'><style id='qiXAr'><dir id='qiXAr'><q id='qiXAr'></q></dir></style></legend>

                1. <small id='qiXAr'></small><noframes id='qiXAr'>