dongshi7350 2019-04-12 12:06
浏览 128

如何从knp paginator的paginate()获取数组而不是对象的值?

I want to get an array in return from paginate().

I am using KNP PAGINATOR.

This is what I am getting:

array (size=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]

It is quite long response I am showing here is a part of it. I want this objects in array form.

  • 写回答

0条回答 默认 最新

    报告相同问题?