# |
Mar 14th 2018, 13:19 |
narendravaghela |
and also thanks @brettl for `dd` |
# |
Mar 14th 2018, 13:19 |
narendravaghela |
thanks :thumbsup: |
# |
Mar 14th 2018, 13:19 |
lorenzo |
Look at the generated query and fix any erros |
# |
Mar 14th 2018, 13:19 |
lorenzo |
Cool I think you can figure it out from here |
# |
Mar 14th 2018, 13:18 |
narendravaghela |
but now `Unknown column TL.id` |
# |
Mar 14th 2018, 13:18 |
lorenzo |
Haha yes @brettl just going slower with him |
# |
Mar 14th 2018, 13:17 |
lorenzo |
Remove it |
# |
Mar 14th 2018, 13:17 |
lorenzo |
Yeah, it is |
# |
Mar 14th 2018, 13:17 |
narendravaghela |
I think I need to remove newExpr() |
# |
Mar 14th 2018, 13:17 |
lorenzo |
I think $q might already be newExpr() and I’m not remembering correctly |
# |
Mar 14th 2018, 13:16 |
slackebot |
'start_time' => 'string', 'TimeLogs__end_time' => 'string', 'TimeLogs.end_time' => 'string', 'end_time' => 'string', 'TimeLogs__hours' => 'integer', 'TimeLogs.hours' => 'integer', 'hours' => 'integer', 'TimeLogs__mins' => 'integer', 'TimeLogs.mins' => 'integer', 'mins' => 'integer', 'TimeLogs__description' => 'text', 'TimeLogs.description' => 'text', 'description' => 'text', 'TimeLogs__created' => 'datetime', |
# |
Mar 14th 2018, 13:16 |
slackebot |
'TimeLogs.created' => 'datetime', 'created' => 'datetime', 'TimeLogs__modified' => 'datetime', 'TimeLogs.modified' => 'datetime', 'modified' => 'datetime' ] [protected] _types => [] } } ``` |
# |
Mar 14th 2018, 13:16 |
slackebot |
'TimeLogs.project_id' => 'integer', 'project_id' => 'integer', 'TimeLogs__task_id' => 'integer', 'TimeLogs.task_id' => 'integer', 'task_id' => 'integer', 'TimeLogs__work_activity_id' => 'integer', 'TimeLogs.work_activity_id' => 'integer', 'work_activity_id' => 'integer', 'TimeLogs__date' => 'date', 'TimeLogs.date' => 'date', 'date' => 'date', 'TimeLogs__start_time' => 'string', 'TimeLogs.start_time' => 'string', |
# |
Mar 14th 2018, 13:16 |
narendravaghela |
``` object(Cake\Database\Expression\QueryExpression) { [protected] _conjunction => 'AND' [protected] _conditions => [] [protected] _typeMap => object(Cake\Database\TypeMap) { [protected] _defaults => [ 'TimeLogs__id' => 'integer', 'TimeLogs.id' => 'integer', 'id' => 'integer', 'TimeLogs__user_id' => 'integer', 'TimeLogs.user_id' => 'integer', 'user_id' => 'integer', 'TimeLogs__project_id' => 'integer', |
# |
Mar 14th 2018, 13:16 |
brettl |
hehe |
# |
Mar 14th 2018, 13:16 |
brettl |
@lorenzo |
# |
Mar 14th 2018, 13:16 |
brettl |
you still showed me that at the conference last year @lorello :slightly_smiling_face: |
# |
Mar 14th 2018, 13:16 |
narendravaghela |
``` |
# |
Mar 14th 2018, 13:16 |
brettl |
:slightly_smiling_face: |
# |
Mar 14th 2018, 13:16 |
brettl |
or dd($q) |
# |
Mar 14th 2018, 13:16 |
lorenzo |
Can you var_dump($q)? |
# |
Mar 14th 2018, 13:15 |
brettl |
https://book.cakephp.org/3.0/en/views/helpers/form.html |
# |
Mar 14th 2018, 13:14 |
loginews |
quick question... where in the manual cake3 can i read about adding an input field to edit.ctp which is not linked to any table field? I just need a form field. |
# |
Mar 14th 2018, 13:12 |
narendravaghela |
and it shows `Method newExpr does not exist` |
# |
Mar 14th 2018, 13:12 |
narendravaghela |
@lorenzo Updated the gist with current code - https://gist.github.com/narendravaghela/9f706ed532403f478d6bcd1f4abac527 |
# |
Mar 14th 2018, 13:08 |
narendravaghela |
hmm, checking... |
# |
Mar 14th 2018, 13:08 |
lorenzo |
From your previous gist it is obvious that newExpr exists, just that you are calling it on something else |
# |
Mar 14th 2018, 13:08 |
narendravaghela |
okay, no problem, I will paste the current code if does not work, so you can review |
# |
Mar 14th 2018, 13:07 |
lorenzo |
Just review it and fix whatever possible mistake I made when writing it. |
# |
Mar 14th 2018, 13:07 |
lorenzo |
Currently on my phone so can’t help a lot more, but what I sent should be enough |
# |
Mar 14th 2018, 13:06 |
narendravaghela |
can you help me preparing that with queryBuilder please? |
# |
Mar 14th 2018, 13:05 |
lorenzo |
you need a join with a subquery |
# |
Mar 14th 2018, 13:05 |
narendravaghela |
and now I am struggling with that sql query in ORM :slightly_smiling_face: |
# |
Mar 14th 2018, 13:04 |
lorenzo |
Yes |
# |
Mar 14th 2018, 13:02 |
narendravaghela |
is it possible using single sql query? |
# |
Mar 14th 2018, 13:01 |
narendravaghela |
my problem is, I have a TimeLogs table. I want to show all rows in table format, but also want to show the total logged hours for particular date |
# |
Mar 14th 2018, 13:01 |
narendravaghela |
it still returns 11 rows |
# |
Mar 14th 2018, 13:01 |
narendravaghela |
I tried to prepare a native sql query without using ORM to check whether if it works or not ``` SELECT si1.* FROM time_logs AS si1 JOIN (SELECT id, sum(id) FROM time_logs GROUP BY date) AS si2 ON si1.id = si2.id ``` |
# |
Mar 14th 2018, 12:59 |
lorenzo |
and did you investigate where that error comes from? |
# |
Mar 14th 2018, 12:53 |
narendravaghela |
@pierre-baptiste.varle use like `Router::url('http://www.google.com')` |
# |
Mar 14th 2018, 12:50 |
pierre-baptiste.varle |
can we use Router::url() to generate link to external website (I would like to use this to manage query options of url) |