# |
Jul 12th 2017, 21:12 |
saeideng |
good by |
# |
Jul 12th 2017, 21:12 |
saeideng |
goof by |
# |
Jul 12th 2017, 21:11 |
sturm |
End of workday; I’m heading home. See you all tomorrow, most likely. |
# |
Jul 12th 2017, 21:10 |
saeideng |
if your table is `users_friends` you should use `users_friends`] |
# |
Jul 12th 2017, 21:09 |
ericadeefox |
you want many users to be able to have many friendships, and many friendships to be able to have many users, like social media yes? those 'Friendships' are entities also and need their own models. |
# |
Jul 12th 2017, 21:08 |
ericadeefox |
probably, I'm horrible at following convention. @konstanting you're gonna want a model for your 'Friendships' as well. |
# |
Jul 12th 2017, 21:08 |
sturm |
Also, @ericadeefox, doesn’t the join table have to be in alphabetical order? i.e., `friends_users` instead of `users_friends`? Not sure if it makes that much of a difference, though. |
# |
Jul 12th 2017, 21:08 |
konstanting |
@ericadeefox No it's just imaginary |
# |
Jul 12th 2017, 21:07 |
ericadeefox |
@konstanting do you have a model built for 'Friendships'? |
# |
Jul 12th 2017, 21:06 |
sturm |
Okay, thanks @saeideng. |
# |
Jul 12th 2017, 21:06 |
ericadeefox |
yes, 'localproject' in this case would be the same as your 'friendship's. |
# |
Jul 12th 2017, 21:06 |
konstanting |
I think the Problem with my relation ist that It relates to the User Modal in both directions |
# |
Jul 12th 2017, 21:06 |
konstanting |
@ericadeefox Is "localproject" a Model too? |
# |
Jul 12th 2017, 21:05 |
ericadeefox |
``` $this->belongsToMany('Users', [ 'foreignKey' => 'localproject_id', 'targetForeignKey' => 'user_id', 'joinTable' => 'users_localprojects' ]);``` |
# |
Jul 12th 2017, 21:04 |
ericadeefox |
this is a similar snippet of code from a many-to-many relation in something that was left untouched after I just baked it: |
# |
Jul 12th 2017, 21:03 |
konstanting |
@ericadeefox If I delete this line it won't work at all |
# |
Jul 12th 2017, 21:03 |
saeideng |
within `request` tab |
# |
Jul 12th 2017, 21:03 |
nicolas.r |
it creates autommaticly model and relations |
# |
Jul 12th 2017, 21:03 |
nicolas.r |
no probleme like dat |
# |
Jul 12th 2017, 21:03 |
saeideng |
also you can see these params on debug_kit panel |
# |
Jul 12th 2017, 21:02 |
nicolas.r |
@konstanting personnaly i create my schema db with SQL and I do a cake bake model myModel |
# |
Jul 12th 2017, 21:02 |
ericadeefox |
@konstanting try getting rid of `'className' => 'Users'` |
# |
Jul 12th 2017, 21:02 |
saeideng |
so if you want first key/value of that you need use getParam(pass.0) |
# |
Jul 12th 2017, 21:01 |
saeideng |
`getParam('pass')` returned `[0=>1,1=>2,2=>3.3=>4]` |
# |
Jul 12th 2017, 21:01 |
slackebot |
'friend_id' ]);``` |
# |
Jul 12th 2017, 21:01 |
konstanting |
Hey folks, I'm trying to do a many to many relation in cake3 on one model. So one users can have many friends(users). I got it to work in one direction but not the other way around. Has anyone ever encountered a similar problem? Relation looks like this: ``` $this->belongsToMany('Friendships', [ 'className' => 'Users', 'joinTable' => 'users_friends', 'targetForeignKey' => 'user_id', ' |
# |
Jul 12th 2017, 21:00 |
saeideng |
when you have url like `site.com/users/show/1/2/3/4` |
# |
Jul 12th 2017, 20:59 |
saeideng |
i understand your question now from `$this->request->getParam('pass.0');` |
# |
Jul 12th 2017, 20:55 |
nicolas.r |
yup thx |
# |
Jul 12th 2017, 20:54 |
saeideng |
@nicolas.r see dereuromark tiny auth plugin |
# |
Jul 12th 2017, 20:54 |
sturm |
Definitely not good when even the tutorial just leaves you more confused. |
# |
Jul 12th 2017, 20:52 |
saeideng |
otherwise returned false |
# |
Jul 12th 2017, 20:52 |
devito |
@nicolas.r you can run shell using the shell dispatch class |
# |
Jul 12th 2017, 20:52 |
saeideng |
that return param if exist |
# |
Jul 12th 2017, 20:51 |
saeideng |
what you mean from `getParam` and an `id` |
# |
Jul 12th 2017, 20:50 |
nicolas.r |
no :s |
# |
Jul 12th 2017, 20:49 |
burzum |
is anyone here using the cakephp elastic search plugin for doing an aggregation (distinct like)? |
# |
Jul 12th 2017, 20:48 |
sturm |
Not as green as I am. |
# |
Jul 12th 2017, 20:47 |
nicolas.r |
i'm too newbie to answer you i guess |
# |
Jul 12th 2017, 20:47 |
nicolas.r |
no idea :P |
# |
Jul 12th 2017, 20:47 |
sturm |
@nicolas.r I don’t know how to answer that. I’m studying the “Restricting Bookmark Access” portion of the bookmarker tutorial. |