# |
Jul 25th 2017, 15:49 |
ra7bi |
Yah, i got it |
# |
Jul 25th 2017, 15:45 |
ra7bi |
@cleptric do you think i should have 2 tables one for followers and other for following ? |
# |
Jul 25th 2017, 15:45 |
ra7bi |
or how DB should look like |
# |
Jul 25th 2017, 15:44 |
ra7bi |
follow / following |
# |
Jul 25th 2017, 15:44 |
ra7bi |
So be frank with you This is something I'm looking forward to knowing. I do not understand the structure of this system |
# |
Jul 25th 2017, 15:43 |
cleptric |
Wouldn’t the follower thing just be a relation between Users and Users with another join table? |
# |
Jul 25th 2017, 15:42 |
ra7bi |
i think it will work |
# |
Jul 25th 2017, 15:42 |
ra7bi |
followed => who follow me following => who im following user_id => my id |
# |
Jul 25th 2017, 15:42 |
ra7bi |
so i could name it followers and it has user_id / followed_id / following_id |
# |
Jul 25th 2017, 15:41 |
cleptric |
@ra7bi I think that you also could name the table `foo_bar` as long as you configure it correctly in your Tables. I don’t certainly know of any “conventions” besides the one mentioned above. |
# |
Jul 25th 2017, 15:40 |
ra7bi |
,:) |
# |
Jul 25th 2017, 15:39 |
ra7bi |
or i could create a table like " Users_followers" and have user_id_follow / user_id_following hhhh |
# |
Jul 25th 2017, 15:39 |
cleptric |
@tawriq Uff :S I normally do sth like a remember me cookie thing a log the user back in if the session has expired |
# |
Jul 25th 2017, 15:38 |
ra7bi |
user_user_followers |
# |
Jul 25th 2017, 15:38 |
ra7bi |
hhh the name looks crazy |
# |
Jul 25th 2017, 15:38 |
ra7bi |
but im wondering how would look likes the tables name if i have user_user_followers the table which store all users that user follow |
# |
Jul 25th 2017, 15:37 |
tawriq |
Hi @cleptric , PHP 7.1 Cake 3.3.*. Is it possible to change a session expiration date on the fly ? |
# |
Jul 25th 2017, 15:29 |
cleptric |
Cool :slightly_smiling_face: |
# |
Jul 25th 2017, 15:28 |
ra7bi |
i create "user_snippet_like" to store all snippets liked by user and it's seems working |
# |
Jul 25th 2017, 15:28 |
ra7bi |
which link snippets with users |
# |
Jul 25th 2017, 15:28 |
ra7bi |
the name of the table |
# |
Jul 25th 2017, 15:28 |
ra7bi |
users_snippets |
# |
Jul 25th 2017, 15:27 |
chinpei215 |
I am active, but on japanese :P |
# |
Jul 25th 2017, 15:27 |
inoas |
so user_snippets_likes or users_snippets_likes (depending how user_snippets is named) |
# |
Jul 25th 2017, 15:26 |
inoas |
it is always plural in cakephp world |
# |
Jul 25th 2017, 15:26 |
ra7bi |
:) |
# |
Jul 25th 2017, 15:26 |
ra7bi |
i think the table name should be "user_snippet_like" |
# |
Jul 25th 2017, 15:26 |
inoas |
yes many of them ;) |
# |
Jul 25th 2017, 15:25 |
cleptric |
Some of them, like me ^^ |
# |
Jul 25th 2017, 15:25 |
tawriq |
Does anyone know if any of the "https://cakephp.org/pages/team" Core Members are usually active on this slack channel ? |
# |
Jul 25th 2017, 15:25 |
ra7bi |
i will try to find out if there is a solution out of the box with cakephp for this case |
# |
Jul 25th 2017, 15:24 |
ra7bi |
Yah |
# |
Jul 25th 2017, 15:23 |
cleptric |
To be honest, the first time i didn’t find it either ;) |
# |
Jul 25th 2017, 15:22 |
cleptric |
> This is especially handy if you need to define multiple belongsToMany relationships. The default value for this key is the underscored, singular name of the current model, suffixed with ‘_id’. |
# |
Jul 25th 2017, 15:22 |
cleptric |
https://book.cakephp.org/3.0/en/orm/associations.html#belongstomany-associations |
# |
Jul 25th 2017, 15:22 |
ra7bi |
i could not find in doc anything about this case |
# |
Jul 25th 2017, 15:21 |
cleptric |
Just if you want all the Cake Awesomeness, you have to follow the conventions. But you already have a association that doe this ^^ |
# |
Jul 25th 2017, 15:20 |
cleptric |
I tend to name my relation tables in alphabetically order, but in this case it’s up to you. |
# |
Jul 25th 2017, 15:20 |
cleptric |
Yes, and then in your `UsersTable` ``` $this->belongsToMany('Snippets', [ 'joinTable' => 'likes_users' ]); ``` and maybe some more options. Haven’t tried this yet. |
# |
Jul 25th 2017, 15:19 |
ra7bi |
then each time user like snippet , his id along with the snippet he liked will be on this table? |
# |
Jul 25th 2017, 15:18 |
ra7bi |
which has -user_id -snippet_id |