# |
Apr 19th 2017, 10:52 |
Neon1024 |
I get an SQL error because the table isn’t joined, it’s very strange |
# |
Apr 19th 2017, 10:52 |
Neon1024 |
But when you add in an 'Users.first_name' => 'asc' |
# |
Apr 19th 2017, 10:51 |
Neon1024 |
But if it’s joined I should be able order the query |
# |
Apr 19th 2017, 10:51 |
Neon1024 |
Might be because of this, INNER JOIN `users` `Users` ON `Users`.`id` = (`Holidays`.`user_id`) |
# |
Apr 19th 2017, 10:50 |
hmic |
however, i'm not sure if it has to do with your actual problem really. but maybe you try with just adding ->order() without contain/matching just to get a better idea where the error stems from |
# |
Apr 19th 2017, 10:49 |
hmic |
if($team) matching() else contain() |
# |
Apr 19th 2017, 10:49 |
Neon1024 |
I don’t display the team, so not much use containing it |
# |
Apr 19th 2017, 10:49 |
Neon1024 |
No, you’re right |
# |
Apr 19th 2017, 10:49 |
hmic |
as long as you do not use a different alias, it makes no sense to me |
# |
Apr 19th 2017, 10:48 |
Neon1024 |
It’s a holiday calendar :) |
# |
Apr 19th 2017, 10:48 |
hmic |
still an eigher or |
# |
Apr 19th 2017, 10:48 |
Neon1024 |
As I still want to show all the days |
# |
Apr 19th 2017, 10:48 |
Neon1024 |
So I can find all the days with users on holiday, who are in a certain team |
# |
Apr 19th 2017, 10:48 |
Neon1024 |
It’s conditional |
# |
Apr 19th 2017, 10:47 |
hmic |
it's an eigher/or, isn't it? |
# |
Apr 19th 2017, 10:47 |
hmic |
why do you contain and matching teams btw? |
# |
Apr 19th 2017, 10:47 |
hmic |
maybe the matching associated with it?! |
# |
Apr 19th 2017, 10:46 |
hmic |
in this case the order should but work |
# |
Apr 19th 2017, 10:45 |
Neon1024 |
No, turns out it’s a hasMany, so it’s doing two queries rather than joining |
# |
Apr 19th 2017, 10:42 |
hmic |
Neon1024, order problem fixed? |
# |
Apr 19th 2017, 10:41 |
joop |
but i can not acces the data any other way |
# |
Apr 19th 2017, 10:41 |
joop |
the query is returning fine as showing the toArray method |
# |
Apr 19th 2017, 10:41 |
hmic |
just use crud and crudview and like 2 days of time and i get any 1.2 app would be rewritten *fg* |
# |
Apr 19th 2017, 10:41 |
Neon1024 |
Doubt it would be anyones choice! |
# |
Apr 19th 2017, 10:41 |
Neon1024 |
No, I imagine not |
# |
Apr 19th 2017, 10:41 |
cobra-the-joker |
Neon1024: not my choice :( |
# |
Apr 19th 2017, 10:40 |
hmic |
the app cannot do much anyways, so rewrite to 3.4 would be the thing :D |
# |
Apr 19th 2017, 10:40 |
Neon1024 |
Upgrade to 1.3 ? :p |
# |
Apr 19th 2017, 10:39 |
dereuromark |
my memory gives up on my after ~3 years, but 10+ years is too much I am afraid |
# |
Apr 19th 2017, 10:39 |
Neon1024 |
Appropriate nickname I think cobra-the-joker ;) |
# |
Apr 19th 2017, 10:39 |
dereuromark |
cobra-the-joker: even 10+ veterans like me dont know anything about that ancient framework version anymore :S |
# |
Apr 19th 2017, 10:39 |
hmic |
cobra-the-joker, can you repeat that version number again please? |
# |
Apr 19th 2017, 10:37 |
joop |
but its seems there no wrong with the query |
# |
Apr 19th 2017, 10:36 |
cobra-the-joker |
Hey guys , i am having a problem with cake 1.2 ... i use paginate on a model .... but it doesn't return with it the hasOne element that i set in the controller , any help ? |
# |
Apr 19th 2017, 10:36 |
Neon1024 |
Class autoloading != Loading a component |
# |
Apr 19th 2017, 10:35 |
Neon1024 |
See above. |
# |
Apr 19th 2017, 10:35 |
joop |
use Cake\Controller\Component\AuthComponent; |
# |
Apr 19th 2017, 10:35 |
joop |
i inserted the AuthComponent |
# |
Apr 19th 2017, 10:35 |
Neon1024 |
https://book.cakephp.org/3.0/en/controllers/components/authentication.html |
# |
Apr 19th 2017, 10:35 |
Neon1024 |
joop: Well I can’t find an example in the book, but you’ll need a $this->loadComponent(‘Auth’, $myAuthConfig); somewhere in your controller, usually AppController::initialize |
# |
Apr 19th 2017, 10:34 |
hmic |
add the first_name to the order in line 31 i guess |