Log message #4056868

# At Username Text
# Jul 25th 2017, 16:16 rogerpro For efficiency, @admad. Why using a behaviour many times per minute if I only want it once a year?
# Jul 25th 2017, 16:15 rogerpro And, by the way, `updateAll`does not trigger `beforeSave` https://book.cakephp.org/3.0/en/orm/saving-data.html#bulk-updates
# Jul 25th 2017, 16:14 admad Why not if it does the job you want?
# Jul 25th 2017, 16:13 rogerpro About CounterCacheBehavior: I don’t want to enable a Behaviour on a Model just to use it once. I will study it more deeply
# Jul 25th 2017, 16:12 rogerpro Yes, but this is not the case. I want tu run this “recalculation process” just now and maybe for some particular reasons on the future. Not on any regular basis.
# Jul 25th 2017, 16:11 cleptric Normally you would call `updateAll` in your afterSave if you want to update something based on a saved entity
# Jul 25th 2017, 16:11 rogerpro Thanks! I will take a look. It was mentioned many times at CakeFest
# Jul 25th 2017, 16:10 rogerpro Maybe with an Expression on the query() but… I find this complicated
# Jul 25th 2017, 16:10 cleptric It does similar things
# Jul 25th 2017, 16:10 cleptric Have a look at the CounterCacheBehavior
# Jul 25th 2017, 16:10 rogerpro The goal is to trigger a save on all entities. `afterSave`will work for only one specific entity
# Jul 25th 2017, 16:09 rogerpro I’m playing with the console and `$my_table->query()->update()->execute);` but it needs a SET
# Jul 25th 2017, 16:08 cleptric `afterSave`? :slightly_smiling_face:
# Jul 25th 2017, 16:08 rogerpro As a challenge, I want to have it on a shell, in a good Cake way. Not only running SQL which I can do in 2 minutes
# Jul 25th 2017, 16:08 rogerpro In other words, I want to recalculate a specific field for all files of the table
# Jul 25th 2017, 16:07 rogerpro Just to “resave” all entities to force running beforSave(), which is a method that I created after many entities were saved
# Jul 25th 2017, 16:06 cleptric What do you want to do?
# Jul 25th 2017, 16:05 rogerpro Sorry, I mean already existing entities
# Jul 25th 2017, 16:05 cleptric Add the method to your table
# Jul 25th 2017, 16:04 rogerpro What is the best way to run `beforeSave()` for all the entities of a table?
# Jul 25th 2017, 16:00 cleptric Wouldn’t be a compound key be sufficient?
# Jul 25th 2017, 15:59 neon1024 Shouldn’t the join/pivot table have a primary key?
# Jul 25th 2017, 15:49 ra7bi Tks
# 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: