Answer the question
In order to leave comments, you need to log in
How to ignore yii2 TimestampBehavior behavior under certain conditions?
I have a cron that changes the status of posts at a certain time, but since the TimestampBehavior behavior is in the post model, it changes update_at, how best to do so that when the update_at cron works, the date does not change?
Answer the question
In order to leave comments, you need to log in
In general, thanks to everyone, I went the other way, I just did updateAll without using the model and that's it
NEWS::updateAll(
['status' => NEWS::STATUS_CLOSED_BY_CRON],
[
'and',
['<>', 'status', [NEWS::STATUS_CLOSED_BY_MODERATOR, NEWS::STATUS_CLOSED_BY_USER]],
['<', 'updateDate', $date->getTimestamp()]
]
);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question