Answer the question
In order to leave comments, you need to log in
Is it possible in yii2 to pull data from the database into it again during the operation of the ActiveRecord model?
For example, the model has an infinite loop with a certain interval between iterations. Is it possible to update the model in each iteration? Those. to receive actual data in it, which during the cycle could change in the database by a query from another script?
Answer the question
In order to leave comments, you need to log in
there is a refresh() method ; the model, according to your description should help, and it will also be useful to read about optimistic blocking
Why not create a new one being sure that it contains up-to-date data?
Smells like a bike. How long does an AR object live with you, that during this time it is necessary to check the relevance of the data?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question