Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

batch list lost elements if use order arguments #395

Open
mesilov opened this issue Jun 30, 2024 · 0 comments
Open

batch list lost elements if use order arguments #395

mesilov opened this issue Jun 30, 2024 · 0 comments
Assignees
Labels
2.x issue related with 2.x sdk version bug 💠 core 💰 sponsored задача оплачена

Comments

@mesilov
Copy link
Owner

mesilov commented Jun 30, 2024

        $greaterThanDefaultPageSize = 120;
        $originatorId = Uuid::v7()->toRfc4122();
        // add contacts
        $contacts = [];
        for ($i = 0; $i < $greaterThanDefaultPageSize; $i++) {
            $contacts[] = [
                'fields' => [
                    'NAME' => 'name-' . $i,
                    'ORIGINATOR_ID' => $originatorId,
                    'ORIGIN_ID' => $i
                ]
            ];
        }
        $cnt = 0;
        foreach ($this->batch->addEntityItems('crm.contact.add', $contacts) as $addedContactResult) {
            $this->createdContactIds[] = $addedContactResult->getResult()[0];
            $cnt++;
        }
        $this->assertEquals(count($contacts), $cnt);
        $this->assertEquals(count($contacts), $this->serviceBuilder->getCRMScope()->contact()->countByFilter([
            'ORIGINATOR_ID' => $originatorId
        ]));

        // test batch with order
        $readContactsId = [];
        foreach ($this->batch->getTraversableList('crm.contact.list',
            ['ORIGIN_ID' => 'DESC'],
            [
                'ORIGINATOR_ID' => $originatorId
            ],
            [
                'ID',
                'NAME',
                'ORIGINATOR_ID',
                'ORIGIN_ID'
            ],
        ) as $cnt => $itemContact) {
            $readContactsId[] = $itemContact['ID'];
            print($itemContact['ID'] . ' | ' . $itemContact['ORIGIN_ID'] . PHP_EOL);
        }
        $this->assertCount($greaterThanDefaultPageSize, $readContactsId);
@mesilov mesilov added bug 2.x issue related with 2.x sdk version 💰 sponsored задача оплачена 💠 core labels Jun 30, 2024
@mesilov mesilov self-assigned this Jun 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.x issue related with 2.x sdk version bug 💠 core 💰 sponsored задача оплачена
Projects
None yet
Development

No branches or pull requests

1 participant