# |
Dec 30th 2018, 14:11 |
slackebot |
Accounts.master = :c2) GROUP BY Accounts.id ORDER BY Accounts.number ASC 2018-12-30 14:09:49 Error: Api/AccountRecordsController : getTabs |
# |
Dec 30th 2018, 14:11 |
kitcat711 |
2018-12-30 14:09:49 Error: SELECT Accounts.id AS `Accounts__id`, Accounts.lessor_id AS `Accounts__lessor_id`, Accounts.number AS `Accounts__number`, Accounts.name AS `Accounts__name`, Accounts.parent_id AS `Accounts__parent_id`, ar.balance AS `ar__balance` FROM accounts Accounts LEFT JOIN accounting_records ar ON (Accounts.number = ar.account_number AND Accounts.lessor_id = ar.lessor_id AND ar.id = :c0) WHERE (Accounts.lessor_id = :c1 OR |
# |
Dec 30th 2018, 14:11 |
kitcat711 |
got only that: |
# |
Dec 30th 2018, 14:08 |
kitcat711 |
checking back |
# |
Dec 30th 2018, 14:08 |
challgren |
it doesnt give you parameters? |
# |
Dec 30th 2018, 14:08 |
kitcat711 |
Actually, @challgren, debug($query) provides the same log that sql($query) |
# |
Dec 30th 2018, 14:07 |
challgren |
Wb |
# |
Dec 30th 2018, 14:07 |
kitcat711 |
back |
# |
Dec 30th 2018, 13:24 |
challgren |
If im not here and you havent found a solution |
# |
Dec 30th 2018, 13:24 |
challgren |
I may or may not be around but I’ll check in and mention you |
# |
Dec 30th 2018, 13:24 |
challgren |
ok |
# |
Dec 30th 2018, 13:23 |
kitcat711 |
ok, I must go for lunch (wife calling), brb :slightly_smiling_face: |
# |
Dec 30th 2018, 13:23 |
challgren |
Ok a debug($query) would be better sorry |
# |
Dec 30th 2018, 13:23 |
kitcat711 |
https://gist.github.com/Kitcat711/6b440733f5566b243c946bdf047a99fa @challgren |
# |
Dec 30th 2018, 13:14 |
kitcat711 |
ok, right on it |
# |
Dec 30th 2018, 13:12 |
challgren |
If you can post that as a gist that would be helpful for me |
# |
Dec 30th 2018, 13:11 |
challgren |
You know you can put in sql($query) to see the sql that is generated |
# |
Dec 30th 2018, 13:09 |
challgren |
actually update your fields you have commented out and add `'balance' => 'IFNULL(ar.balance, 0)'` to the field list |
# |
Dec 30th 2018, 13:08 |
challgren |
1 min let me make a revision |
# |
Dec 30th 2018, 13:07 |
kitcat711 |
I mean as a field in the array result |
# |
Dec 30th 2018, 13:06 |
kitcat711 |
@challgren actually, no error, but I don’t get the ‘ar.balance’ I am seekeing |
# |
Dec 30th 2018, 13:02 |
rightscoreanalysis |
scrap that calling the param form the wrong template :slightly_smiling_face: |
# |
Dec 30th 2018, 13:01 |
challgren |
Did that work @kitcat711? |
# |
Dec 30th 2018, 12:57 |
rightscoreanalysis |
I followed the example in the book |
# |
Dec 30th 2018, 12:57 |
rightscoreanalysis |
Warning (2): Missing argument 1 for... |
# |
Dec 30th 2018, 12:57 |
rightscoreanalysis |
however if I debug the param in my cell: public function display($id) { debug($id); |
# |
Dec 30th 2018, 12:57 |
rightscoreanalysis |
I'm trying to pass a variable to my cell with: <?= $this->cell('LatestArticle', [$article->id]); ?> |
# |
Dec 30th 2018, 12:55 |
challgren |
Let me know if it works |
# |
Dec 30th 2018, 12:55 |
kitcat711 |
Thanks @challgren |
# |
Dec 30th 2018, 12:55 |
kitcat711 |
thanks, trying right away |
# |
Dec 30th 2018, 12:54 |
kitcat711 |
Yes, I am not sure that I need it, but this is what I am investingating. The difficulty, to me, is that is it refering to AccountingRecords Table, apart from the current join or selet |
# |
Dec 30th 2018, 12:54 |
challgren |
Granted completely untested since I dont have access to the DB or any example data |
# |
Dec 30th 2018, 12:53 |
challgren |
@kitcat711 checkout https://gist.github.com/challgren/a50da07c50da2a6a7b3350dc728f5950 |
# |
Dec 30th 2018, 12:47 |
challgren |
https://book.cakephp.org/3.0/en/orm/query-builder.html#subqueries |
# |
Dec 30th 2018, 12:45 |
challgren |
Is that what I’m understaindg? |
# |
Dec 30th 2018, 12:44 |
challgren |
So line 28 on your gist you need a subquery? |
# |
Dec 30th 2018, 12:44 |
challgren |
Nevermind on the “You ar array should just be an array and not have the key ar….” |
# |
Dec 30th 2018, 12:43 |
kitcat711 |
nm? |
# |
Dec 30th 2018, 12:43 |
kitcat711 |
@challgren: reading it, so far was trying with function($q) and subqueries, but nothing worked so I am ready to investigate the leftjoinWith |
# |
Dec 30th 2018, 12:43 |
challgren |
actually nm |
# |
Dec 30th 2018, 12:40 |
challgren |
You ar array should just be an array and not have the key ar. You also need `'alias' => 'ar'` |