I'm using Yii2
and I have a situation where I want to make some code globally available, but only for that request.
My use case is based on this question where I am doing some permission checks via a matchCallback
.
I need to run a few different permission checks and if I can't do them all in the one place via the matchCallback
(because I can't access all of the data I need it seems at that specific time) - then I am trying to avoid having to run the query again.
So, I was wondering if I could store data retrieved from the database such as a JSON encoded permission array within my matchCallback
functionaltiy so I could then access that array within another action.
I know I could use flash data
, but that seems like it is more meant for the next
request. Is there anything available for just the current request or should I just use flash data
anyway?