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

Sorting by Page fields and MySQL strict mode #1974

Open
thetuningspoon opened this issue Aug 12, 2016 · 1 comment
Open

Sorting by Page fields and MySQL strict mode #1974

thetuningspoon opened this issue Aug 12, 2016 · 1 comment

Comments

@thetuningspoon
Copy link

thetuningspoon commented Aug 12, 2016

With MySQL strict mode (specifically, only_full_group_by) enabled, the following selector (where location_select is a multi-Page field) gives the resulting error:

$this->pages->get('template=People')->children("sort=location_select.title, limit=30");

Error: Exception: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'example._sort_page_location_select_title.data' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by (in /examplepath/wire/core/PageFinder.php line 384)

If I understand it correctly, this is because the location_select page field returns multiple results, and MySQL doesn't know which one to use. It appears that there is no way in PW to specify location_select.first.title, location_select.last.title or location_select.eq[3].title to narrow down the sort to the specific page you wish to sort the PageArray by. This would be a very useful enhancement.

@ryancramerdesign
Copy link
Owner

I don't see a way to support this currently, but am going to keep this open in case anything turns up. Thanks.

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

No branches or pull requests

2 participants