# |
Dec 30th 2018, 17:17 |
k4t |
how do you handle follwing scenario: you have some tables in db, u baked models based on current tables structure. Now you added to the database tables some new columns, removed old ones etc |
# |
Dec 30th 2018, 17:16 |
k4t |
hi guys |
# |
Dec 30th 2018, 14:34 |
challgren |
Can you gist the structure for accounts and accounting_records please |
# |
Dec 30th 2018, 14:32 |
challgren |
Now that I’m reading what your trying to accomplish |
# |
Dec 30th 2018, 14:32 |
challgren |
I think your query might be a bit overkill |
# |
Dec 30th 2018, 14:31 |
kitcat711 |
got it in debugkit I think |
# |
Dec 30th 2018, 14:28 |
challgren |
https://book.cakephp.org/3.0/en/orm/retrieving-data-and-resultsets.html#debugging-queries-and-resultsets the debug should be outputting the bound parameters and its not |
# |
Dec 30th 2018, 14:27 |
kitcat711 |
yes |
# |
Dec 30th 2018, 14:23 |
challgren |
Do you have debugkit enabled? |
# |
Dec 30th 2018, 14:23 |
kitcat711 |
but same result xith debug($query) or sql($query) |
# |
Dec 30th 2018, 14:22 |
kitcat711 |
https://gist.github.com/Kitcat711/6b440733f5566b243c946bdf047a99fa |
# |
Dec 30th 2018, 14:20 |
challgren |
Ahh ok |
# |
Dec 30th 2018, 14:20 |
kitcat711 |
Here I must debug to file for it is called through the api of the app => nothing on the screen |
# |
Dec 30th 2018, 14:19 |
challgren |
I think debug outputs to browser and log depending on settings |
# |
Dec 30th 2018, 14:19 |
kitcat711 |
gonna gist the debug |
# |
Dec 30th 2018, 14:19 |
kitcat711 |
well ERROR is just appearing because this is in the log error |
# |
Dec 30th 2018, 14:14 |
challgren |
do debug($query); please and gist that |
# |
Dec 30th 2018, 14:14 |
challgren |
Hmm so you are getting a SQL error |
# |
Dec 30th 2018, 14:11 |
kitcat711 |
which looks like the very same to me |
# |
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: |