# |
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 |
# |
Mar 3rd 2018, 21:34 |
obinoob |
savant exactly plus in every user I want to add the joined column |
# |
Mar 3rd 2018, 21:28 |
savant |
okay so you want all users where they have a specific team id? |
# |
Mar 3rd 2018, 21:28 |
obinoob |
savant Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'UserTeams.team_id' in 'where clause' |
# |
Mar 3rd 2018, 20:54 |
savant |
what happens when you do that? |
# |
Mar 3rd 2018, 20:54 |
savant |
what isnt working there? |
# |
Mar 3rd 2018, 20:54 |
obinoob |
savant not working for me https://gist.github.com/obinoob/40cb5912ed8be7be87918afd40eb224a |
# |
Mar 3rd 2018, 20:48 |
birdy247 |
@savant I think I will look into that |
# |
Mar 3rd 2018, 20:46 |
savant |
@birdy247 If you have a footprint there, I would def see if you can consult with a lawyer to see what the actual impact upon you is |