I
I
Ivanoff-i2017-04-10 15:48:59
Yii
Ivanoff-i, 2017-04-10 15:48:59

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

2 answer(s)
A
Alexey Likhachev, 2017-04-10
@Ivanoff-i

there is a refresh() method ; the model, according to your description should help, and it will also be useful to read about optimistic blocking

M
Maxim Timofeev, 2017-04-10
@webinar

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 question

Ask a Question

731 491 924 answers to any question