如何从knp分页器的paginate()获取数组中的值而不是对象?

时间:2019-04-12 12:06:40

标签: php arrays symfony object knppaginator

  

我想从paginate()返回一个数组。

我正在使用 KNP分页器。

  

这就是我得到的:

数组(大小= 3)

0 => 
    object(Webkul\CampusConnect\Entity\Student)[953]
      private 'id' => int 2
      private 'studentWalkins' => 
        object(Doctrine\ORM\PersistentCollection)[997]
          private 'snapshot' => 
            array (size=0)
              ...
          private 'owner' => 
            &object(Webkul\CampusConnect\Entity\Student)[953]
          private 'association' => 
            array (size=15)
              ...
          private 'em' => 
            object(Doctrine\ORM\EntityManager)[216]
              ...
          private 'backRefFieldName' => string 'student' (length=7)
          private 'typeClass' => 
            object(Doctrine\ORM\Mapping\ClassMetadata)[974]
              ...
          private 'isDirty' => boolean false
          protected 'collection' => 
            object(Doctrine\Common\Collections\ArrayCollection)[998]
              ...
          protected 'initialized' => boolean false
      private 'resume_path' => string '/assets/uploaded_files/student/resume/AdmitCard.pdf' (length=51)
      private 'user' => 
        object(Webkul\CampusConnect\Entity\User)[400]
          private 'id' => int 2
          private 'email' => string 'saurabh@webkul.com' (length=18)
          private 'password' => string '$2y$13$kf5SPk2uvuQAx8reouz1tOageedl8t//a89J04xNTUb9mYcLZTSx2' (length=60)
          private 'firstName' => string 'Kumar' (length=5)
          private 'lastName' => string 'Saurabh' (length=7)
          private 'verificationCode' => null
          private 'roles' => null
          private 'contactNumber' => string '978798799798' (length=12)
          private 'profileImage' => string '/assets/uploaded_files/student/profileImages/erp.png' (length=52)
          private 'notificationToken' => null
          private 'subscribedTopics' => null
          private 'isContactNumberVerified' => null
          private 'contactNumberOTP' => null
      private 'college' => 
        object(Webkul\CampusConnect\Entity\College)[1240]
          private 'id' => int 1
          private 'name' => string 'JNU' (length=3)
          private 'collegeId' => null
          private 'isActive' => boolean true
          private 'location' => null
          private 'icon' => string 'assets/uploaded_files/college/logo/me.jpg' (length=41)
          private 'description' => string '' (length=0)
          private 'students' => 
            object(Doctrine\ORM\PersistentCollection)[1242]

我在这里展示的响应是相当长的一部分。我希望这些对象采用数组形式。

0 个答案:

没有答案