Cake3 - Clean way to use session in models

2014-09-23 Thread bato
Hi, I would know if there is a way to access to session user in Models. I have a table with user_created and user_modified fields. Saving Table user_created is only filled if Entity is new instead user_modified is always filled. I can populate user_created and user_modified in controller but

Re: Cake3 - Clean way to use session in models

2014-09-23 Thread euromark
I would say: Pass in the data from the controller. Also - this should give you an answer: https://github.com/ceeram/blame mark Am Dienstag, 23. September 2014 10:02:27 UTC+2 schrieb bato: Hi, I would know if there is a way to access to session user in Models. I have a table with

Re: Cake3 - Clean way to use session in models

2014-09-23 Thread alaxos
Another similar idea using a Component instead of a trait: https://github.com/alaxos/cakephp3-libs/blob/master/src/Controller/Component/UserLinkComponent.php https://github.com/alaxos/cakephp3-libs/blob/master/src/Model/Behavior/UserLinkBehavior.php Nico On Tuesday, September 23, 2014 2:03:06