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

Correct pagination while displaying contacts #1125

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Shadow243
Copy link
Member

Paging affects groups.

Ex: if in trusted Contacts there are 100 contacts and in Collected Contacts we have 2 contacts, the pagination will ensure that the 2 contacts in Collected are not displayed.

In this PR we group first then we paginate what is already grouped

@Shadow243
Copy link
Member Author

There is an other issue reported by @Baraka24 and which concerns this PR.

@Shadow243 Shadow243 force-pushed the correct-contact-group branch 2 times, most recently from 64d315d to 5514731 Compare July 19, 2024 23:29
@Shadow243 Shadow243 marked this pull request as draft July 19, 2024 23:29
@Shadow243 Shadow243 force-pushed the correct-contact-group branch 3 times, most recently from 5d777af to 06779dd Compare July 20, 2024 10:34
@Shadow243 Shadow243 marked this pull request as ready for review July 20, 2024 10:36
@Shadow243 Shadow243 requested review from kroky and removed request for josaphatim August 3, 2024 17:13
} elseif (is_object($value)) {
$reflection = new ReflectionClass($value);
$property = $reflection->getProperty('data');
$property->setAccessible(true); // Make the private property accessible
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a reason why private properties are private and using reflection to bypass this is something nasty. If this is a contact object isn't $value->value($_key) enough to get you what you want?

}

public function group_by($column = 'group') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you refactor the code to group by a string version of the column name? I don't see a reason we group by a callable or support cases for array or object contacts. You can refactor calling code to ensure we are working with a standard set of data - either array of arrays or array of contact objects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants