# |
Feb 3rd 2018, 22:52 |
ahmed_bodi |
ok let me try that. I'd have preferred to do the one query on the user obj and load this associated data if possible |
# |
Feb 3rd 2018, 22:52 |
ahmed_bodi |
ok let me try that. I'd have preferred to do the one query on the user obj and load this associated data if possibl |
# |
Feb 3rd 2018, 22:52 |
hmic |
you are using get(), not find(), you need to use find('tree') i suppose |
# |
Feb 3rd 2018, 22:52 |
ahmed_bodi |
i think so too |
# |
Feb 3rd 2018, 22:51 |
hmic |
but i guess your issue is, you are not quering correctly |
# |
Feb 3rd 2018, 22:51 |
ahmed_bodi |
lft and rght are all populated |
# |
Feb 3rd 2018, 22:51 |
hmic |
if you do something stupid/wrong, you need to repair |
# |
Feb 3rd 2018, 22:51 |
hmic |
if you upgrade your table that only has parent_id fields populated, you need to repair |
# |
Feb 3rd 2018, 22:50 |
hmic |
if you are working with it correctly, you dont. |
# |
Feb 3rd 2018, 22:50 |
ahmed_bodi |
including the app root |
# |
Feb 3rd 2018, 22:50 |
hmic |
did you read the docs on how to work with it? |
# |
Feb 3rd 2018, 22:50 |
ahmed_bodi |
i used cakephp to add all of the values |
# |
Feb 3rd 2018, 22:50 |
ahmed_bodi |
do i have to repair it every time? |
# |
Feb 3rd 2018, 22:50 |
hmic |
did you repair the tree to get the lft/rgt values right? |
# |
Feb 3rd 2018, 22:49 |
hmic |
have you read how to query the tree in the docs? |
# |
Feb 3rd 2018, 22:49 |
ahmed_bodi |
i need 2 and 3 |
# |
Feb 3rd 2018, 22:49 |
ahmed_bodi |
Now when i do users->get(id, ['contain' => ['Referrals.Users']]) I only get myself |
# |
Feb 3rd 2018, 22:48 |
ahmed_bodi |
@hmic yeah im having issues lol, So i've done all that. Created an app root and 3 additional items in the tree. with each of those referencing the last e.g. app->1->2->3 and the user i'm logged into is number 1. |
# |
Feb 3rd 2018, 22:47 |
hmic |
i'm not on slack |
# |
Feb 3rd 2018, 22:47 |
hmic |
fail! |
# |
Feb 3rd 2018, 22:45 |
davinci |
File uploaded https://cakesf.slack.com/files/U3J95PPD5/F93JP36DB/-.txt / https://slack-files.com/T053DPNCM-F93JP36DB-19b48354af - \Cake\Error\Debugger::log($response-andgt;getSelectTypeMap()); just returns this. |
# |
Feb 3rd 2018, 22:43 |
davinci |
will try that. I couldn't change the depth Thought it'd be , just `... ::log($response, 7, 4);` |
# |
Feb 3rd 2018, 22:40 |
hmic |
davinci: try $query->getSelectTypeMap(), maybe? |
# |
Feb 3rd 2018, 22:40 |
davinci |
nm - found in book |
# |
Feb 3rd 2018, 22:38 |
davinci |
how do I "increase the depth"? |
# |
Feb 3rd 2018, 22:37 |
hmic |
but sometimes you need to tell it |
# |
Feb 3rd 2018, 22:37 |
hmic |
cake usually guesses your types very well |
# |
Feb 3rd 2018, 22:37 |
hmic |
it makes a hell lot of a difference if you bound value is 0 or '0' |
# |
Feb 3rd 2018, 22:36 |
hmic |
but, i am very certain it does, but it's of the wrong type! |
# |
Feb 3rd 2018, 22:36 |
hmic |
to see it in the dump, just increase the depth |
# |
Feb 3rd 2018, 22:36 |
hmic |
:D |
# |
Feb 3rd 2018, 22:36 |
hmic |
! |
# |
Feb 3rd 2018, 22:36 |
hmic |
i can tell you? |
# |
Feb 3rd 2018, 22:36 |
davinci |
trying to determine why the query doesn't appear to be using the value I think it should be using |
# |
Feb 3rd 2018, 22:34 |
hmic |
davinci: whats the usecase? |
# |
Feb 3rd 2018, 22:33 |
davinci |
Cake 3's query object has 'sql', which you can get by `->sql()`, and it also has 'params', which I cannot figure out how to access. Details of my problem here. Any help GREATLY appreciated. https://stackoverflow.com/questions/48602025/how-to-get-params-from-query-object-in-cakephp-3 |
# |
Feb 3rd 2018, 22:11 |
hmic |
rather a nice explanation on who to think of working with the tree... |
# |
Feb 3rd 2018, 22:11 |
hmic |
;) |
# |
Feb 3rd 2018, 22:11 |
ahmed_bodi |
thats a nice solution |
# |
Feb 3rd 2018, 22:10 |
hmic |
this way you can get a tree of all users of you app too :D |
# |
Feb 3rd 2018, 22:10 |
hmic |
just make evey user level 1 below your "app" root-node |