# |
Jan 22nd 2017, 17:46 |
hmic |
hytromo: maybe you need to execute the query first, then apply the collection function |
# |
Jan 22nd 2017, 17:46 |
thinkingmedia |
try including the alias `->groupBy('ProfessorVisitorHours.day')` |
# |
Jan 22nd 2017, 17:45 |
hytromo |
thinkingmedia, I know, I am talking about Collection's groupBy, not query's group ( https://book.cakephp.org/3.0/en/orm/query-builder.html#aggregates-group-and-having> VS <https://book.cakephp.org/3.0/en/core-libraries/collections.html#grouping-and-counting ) |
# |
Jan 22nd 2017, 17:44 |
thinkingmedia |
Group by SQL is not the same thing as group the results. |
# |
Jan 22nd 2017, 17:44 |
hytromo |
I also tried converting toArray() first and then passing it to a normal Collection object, and still it didn't work. Ideas? |
# |
Jan 22nd 2017, 17:43 |
hytromo |
I fetch some rows from the db and I want to group the results by the field 'day' (int from 0 to 6 for day of week)). `$this->ProfessorVisitHours->find()->where(['professor_id' => $id])->groupBy('day')` doesn't work at all. |
# |
Jan 22nd 2017, 17:33 |
al_x_mq |
i made it work. thanks |
# |
Jan 22nd 2017, 17:33 |
hmic |
"If a Table contains a foreign key, it belongs to the other Table." |
# |
Jan 22nd 2017, 17:33 |
hmic |
al_x_mq: from the book: https://book.cakephp.org/3.0/en/orm/associations.html#belongsto-associations |
# |
Jan 22nd 2017, 17:15 |
al_x_mq |
is this belongsTo or hasOne? |
# |
Jan 22nd 2017, 17:15 |
al_x_mq |
in schedules fields home and guest |
# |
Jan 22nd 2017, 17:14 |
al_x_mq |
table schedules |
# |
Jan 22nd 2017, 17:14 |
al_x_mq |
table of teams |
# |
Jan 22nd 2017, 17:14 |
al_x_mq |
want to build a game schedule |
# |
Jan 22nd 2017, 17:14 |
al_x_mq |
example. |
# |
Jan 22nd 2017, 17:14 |
al_x_mq |
how can i connect 2 tables, over a field, that is not fitting the convention? |
# |
Jan 22nd 2017, 16:18 |
slackebot |
Action: admad hands hmic some calming down juice |
# |
Jan 22nd 2017, 16:16 |
hmic |
throws his hands up *shudders* |
# |
Jan 22nd 2017, 16:14 |
hmic |
and please upgrade to a recent 2.x release, *now* |
# |
Jan 22nd 2017, 16:14 |
admad |
*your |
# |
Jan 22nd 2017, 16:13 |
admad |
just update you js code accordingly and you won't have to much around with the controller code |
# |
Jan 22nd 2017, 16:13 |
hmic |
like admad said. you don't pass anything to login(), if you want the login data beeing checked, make sure your post data is correct rather, as that is what the login checks on a form auth |
# |
Jan 22nd 2017, 16:13 |
admad |
set `$this->request->data['User']['email']` and similarly password and call ->login() without params |
# |
Jan 22nd 2017, 16:12 |
hmic |
https://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#identifying-users-and-logging-them-in, scroll down to the red box and read carefully |
# |
Jan 22nd 2017, 16:12 |
hmic |
but there is no excuse to sticking with a totally outdaed 2.x! |
# |
Jan 22nd 2017, 16:11 |
hmic |
not upgrading to 3.x might be a thing |
# |
Jan 22nd 2017, 16:11 |
hmic |
oh man |
# |
Jan 22nd 2017, 16:11 |
execv |
2.3.3 |
# |
Jan 22nd 2017, 16:10 |
execv |
I have the same result if I don’t pass anything to Auth->login() |
# |
Jan 22nd 2017, 16:10 |
admad |
what version of cake are you using? |
# |
Jan 22nd 2017, 16:10 |
admad |
if you do that the params will be just set to session, no db check will be done |
# |
Jan 22nd 2017, 16:09 |
admad |
don't pass anything to login |
# |
Jan 22nd 2017, 16:09 |
execv |
Nevermind. Auth->user() isn’t empty, but it’s the array I am passing to login |
# |
Jan 22nd 2017, 16:08 |
execv |
Auth Setup: http://pastebin.com/55xgXNkX |
# |
Jan 22nd 2017, 16:08 |
execv |
I’m not starting a new app. I’m just adding an ajax login to an existing one. The current login() function is working perfectly |
# |
Jan 22nd 2017, 16:07 |
hmic |
additionally, why do you start out a new app on 2.x still? |
# |
Jan 22nd 2017, 16:07 |
hmic |
you do actually very likely need to show your auth setup |
# |
Jan 22nd 2017, 16:07 |
execv |
It’s empty |
# |
Jan 22nd 2017, 16:07 |
hmic |
execv, try debuggin Auth->user() instead, whats in? |
# |
Jan 22nd 2017, 15:59 |
execv |
Any help as to why this isn’t working? http://pastebin.com/fSvUiZ2W I am trying to log a user in using AJAX. Regardless of what I send as the username and password, this->Auth->login() always returns true, but never with a UID. |
# |
Jan 22nd 2017, 15:46 |
hmic |
just use the proper function for the task: array_key_exists |