Skip to content

Need sample code for pagination  #115

@Tameem-Ahmad-com

Description

@Tameem-Ahmad-com

i need pagination example if you have , need to fetch 100 records per page

 $page = 1;
            $query = $this->xmlQuery();
            $fetchXML = $this->xmlQuery();
            $result = $client->RetrieveMultiple($query, false, null, 100, $page, true);
            foreach ($result->Entities as $contact) {
                $cont=Contacts::updateOrCreate(['crm_id'=>$contact->contactid],[
                    'crm_id'=>$contact->contactid,
                    'crm_contact_array'=>$contact,
                    'is_from_crm'=>1,
                    'is_posted'=>0,
                    
                ]);
        
                // dispatch(new CreateUpdateHubspotContactJob());
            }
            while ($result->MoreRecords) {
                $data = sprintf($fetchXML, htmlentities($result->PagingCookie, ENT_COMPAT | ENT_XML1), ++$page);
                $result = $client->RetrieveMultiple($data);
                foreach ($result->Entities as $contact) {
                    $cont=Contacts::updateOrCreate(['crm_id'=>$contact->contactid],[
                        'crm_id'=>$contact->contactid,
                        'crm_contact_array'=>$contact,
                        'is_from_crm'=>1,
                        'is_posted'=>0,
                        
                    ]);
            
                    // dispatch(new CreateUpdateHubspotContactJob());
                }
            }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions