# |
Mar 12th 2018, 22:33 |
bakro.istvan |
I tought this could be a problem, but it turned it doesn't. I created a liitle POC for this: https://gist.github.com/bakroistvan/2c522cb77b062be32b924dd43e8769cd |
# |
Mar 12th 2018, 22:32 |
bakro.istvan |
My model's name is Person end the table is people. |
# |
Mar 12th 2018, 22:28 |
xinobi |
thank you very much for your help and have a nice meal :) |
# |
Mar 12th 2018, 22:27 |
savant |
good luck :slightly_smiling_face: |
# |
Mar 12th 2018, 22:27 |
savant |
im off for dinner, let me know if you figure it out |
# |
Mar 12th 2018, 22:27 |
savant |
same in your controller code |
# |
Mar 12th 2018, 22:27 |
savant |
find out where in your view you are using plural Users |
# |
Mar 12th 2018, 22:27 |
savant |
not the joinType or strategy |
# |
Mar 12th 2018, 22:27 |
savant |
thats the source of your trouble |
# |
Mar 12th 2018, 22:27 |
savant |
note that I removed the extra `s` |
# |
Mar 12th 2018, 22:26 |
savant |
I’m _guessing_ that you should refer to them in the UserEmails and UserPhones method |
# |
Mar 12th 2018, 22:26 |
savant |
but your table class refers to UserEmails and UserPhones: https://pastebin.com/jmMZvibg |
# |
Mar 12th 2018, 22:26 |
savant |
you have UsersEmails and UsersPhones |
# |
Mar 12th 2018, 22:26 |
savant |
https://pastebin.com/5nkEH2c5 <-- from your Controller code |
# |
Mar 12th 2018, 22:25 |
savant |
in others UserEmails |
# |
Mar 12th 2018, 22:25 |
xinobi |
https://pastebin.com/HFkZNpvD in my view <?= $this->Paginator->sort('UserEmails.address', h('E-Mail')) ?> |
# |
Mar 12th 2018, 22:25 |
savant |
yeah in some cases you are referring to UsersEmails |
# |
Mar 12th 2018, 22:25 |
savant |
ah |
# |
Mar 12th 2018, 22:25 |
savant |
what is in your view? |
# |
Mar 12th 2018, 22:25 |
savant |
not UsersEmails |
# |
Mar 12th 2018, 22:25 |
savant |
the table class is UserEmails |
# |
Mar 12th 2018, 22:24 |
savant |
based on what you showed me |
# |
Mar 12th 2018, 22:24 |
savant |
_also_ it looks like that would be correct |
# |
Mar 12th 2018, 22:24 |
savant |
whats the query generated |
# |
Mar 12th 2018, 22:22 |
xinobi |
savant this is the error Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'UsersEmails.address' in 'order clause' |
# |
Mar 12th 2018, 22:17 |
savant |
what is the _exact_ error you ge |
# |
Mar 12th 2018, 22:17 |
xinobi |
savant the first query runs fine except for pagination query if I hit sort column I get the column not found mysql error |
# |
Mar 12th 2018, 22:16 |
savant |
does that include profiles you want? |
# |
Mar 12th 2018, 22:16 |
savant |
what happens when you run the first query |
# |
Mar 12th 2018, 22:11 |
xinobi |
I can't see all the users that don't have a complete profile ex: if user misses email, phone or address is left out of retrieved pagination query results |
# |
Mar 12th 2018, 22:10 |
savant |
what are the issues you are having? |
# |
Mar 12th 2018, 22:10 |
savant |
okay so on _this_ page |
# |
Mar 12th 2018, 22:09 |
xinobi |
savant https://pastebin.com/jdsLkK9U |
# |
Mar 12th 2018, 21:59 |
savant |
and gist the query for me please |
# |
Mar 12th 2018, 21:59 |
savant |
and then make the query |
# |
Mar 12th 2018, 21:59 |
savant |
make the joinType LEFT |
# |
Mar 12th 2018, 21:58 |
xinobi |
savant with the current setup ->setJoinType('INNER') ->setStrategy('join'); I don't get any sort query error I just can't see users that do not have email or address or phone associated |
# |
Mar 12th 2018, 21:55 |
savant |
for that particular pagination query |
# |
Mar 12th 2018, 21:55 |
savant |
and show me the query it makes |
# |
Mar 12th 2018, 21:55 |
savant |
then run the page |
# |
Mar 12th 2018, 21:55 |
savant |
What I want you to do is use join+LEFT in your models |