# |
Mar 4th 2018, 02:44 |
savant |
heh my next question was going to be “what is that” |
# |
Mar 4th 2018, 02:43 |
mikesmoniker |
File uploaded https://cakesf.slack.com/files/U67NZSL1G/F9J9UB285/screen_shot_2018-03-03_at_8.43.30_pm.png / https://slack-files.com/T053DPNCM-F9J9UB285-efc0527f20 |
# |
Mar 4th 2018, 02:43 |
mikesmoniker |
What I expect.. |
# |
Mar 4th 2018, 02:43 |
savant |
what is the result of the query when run directly |
# |
Mar 4th 2018, 02:42 |
savant |
thats.. interesting |
# |
Mar 4th 2018, 02:34 |
mikesmoniker |
Anyone know what’s up here? https://pastebin.com/ms2tUxcr ORM is generating the right query but seems to be having problems handling the result. |
# |
Mar 3rd 2018, 23:03 |
savant |
night! |
# |
Mar 3rd 2018, 23:03 |
obinoob |
savant thank you again sleeping time ;) |
# |
Mar 3rd 2018, 23:00 |
savant |
heh |
# |
Mar 3rd 2018, 22:56 |
obinoob |
I'm learning as I go it has fewer results but I need to work to put food on the table eheheh |
# |
Mar 3rd 2018, 22:54 |
obinoob |
savant I read cakephp all the time but too many subjects... can only grasp a few :) my next step is about business domain rules! I think that cakephp is missing quite a few things here (and I know about skinny controllers fat models and I like it!). However, sometimes is not enough... |
# |
Mar 3rd 2018, 22:47 |
savant |
no problem! just be patient and stick with it :slightly_smiling_face: |
# |
Mar 3rd 2018, 22:47 |
savant |
docs |
# |
Mar 3rd 2018, 22:47 |
savant |
https://book.cakephp.org/3.0/en/orm/associations.html <-- |
# |
Mar 3rd 2018, 22:47 |
obinoob |
savant thank very much as always you rock :D |
# |
Mar 3rd 2018, 22:44 |
obinoob |
but yes this ORM it has way to many things to deal with I only know the basics but well I'm learning |
# |
Mar 3rd 2018, 22:44 |
obinoob |
savant joins by it self are hard to master |
# |
Mar 3rd 2018, 22:42 |
savant |
relationships are a very powerful way of modeling joins |
# |
Mar 3rd 2018, 22:42 |
savant |
that will make this a bit easier to understand :slightly_smiling_face: |
# |
Mar 3rd 2018, 22:42 |
savant |
you should read about strategies in relationships |
# |
Mar 3rd 2018, 22:42 |
obinoob |
;) |
# |
Mar 3rd 2018, 22:42 |
savant |
\o/ |
# |
Mar 3rd 2018, 22:42 |
obinoob |
savant it worked |
# |
Mar 3rd 2018, 22:40 |
savant |
that makes the join not be inner. |
# |
Mar 3rd 2018, 22:40 |
savant |
remove the strategy key in the join |
# |
Mar 3rd 2018, 22:39 |
obinoob |
savant database error: Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'JoinedUser.team_id' in 'where clause' |
# |
Mar 3rd 2018, 22:36 |
savant |
what is the output of that |
# |
Mar 3rd 2018, 22:36 |
savant |
foreach ($users as $user) { debug($user); die; } |
# |
Mar 3rd 2018, 22:36 |
savant |
err |
# |
Mar 3rd 2018, 22:36 |
obinoob |
savant https://gist.github.com/obinoob/40cb5912ed8be7be87918afd40eb224a |
# |
Mar 3rd 2018, 22:32 |
savant |
each user should have that |
# |
Mar 3rd 2018, 22:30 |
savant |
there should be a `joined_user` or `joined_users` attribute that has the `joined` attribute in it |
# |
Mar 3rd 2018, 22:28 |
savant |
what is the debug output of the users collection |
# |
Mar 3rd 2018, 22:28 |
obinoob |
savant https://gist.github.com/obinoob/40cb5912ed8be7be87918afd40eb224a |
# |
Mar 3rd 2018, 22:06 |
savant |
what is the code you are using now? |
# |
Mar 3rd 2018, 22:05 |
obinoob |
savant it works but I can't add the column 'joined', either way my sql query works perfectly just need to have a orm equivalent |
# |
Mar 3rd 2018, 21:45 |
savant |
yep |
# |
Mar 3rd 2018, 21:44 |
obinoob |
savant should I add the hasOne association to users table? |
# |
Mar 3rd 2018, 21:36 |
savant |
then you can query like you want :slightly_smiling_face: |
# |
Mar 3rd 2018, 21:35 |
savant |
to create a hasOne version of that relation |
# |
Mar 3rd 2018, 21:35 |
savant |
obinoob: use the trick admad showed you yesterday: https://gist.github.com/ADmad/0a451d837f019edf3447 |