Answer the question
In order to leave comments, you need to log in
Why does the console controller behave differently than the Yii2 web controller?
I have a script like this:
$timeNow = new \DateTime(date("Y-m-d H:i:s"), new \DateTimeZone('UTC'));
$interval = new \DateInterval('PT'. Yii::$app->params['intervalMinForDescicionIssue'] .'M');
$timeCorrect = $timeNow->sub($interval);
$issues = Issue::find()
->where(['between', 'createdDate', $timeCorrect->format("Y-m-d H:i:s"), date("Y-m-d H:i:s")])
->all();
foreach ($issues as $issue) {
$issue->countMin++;
if($issue->countMin >= Yii::$app->params['intervalMinForIssuePrice']){
$issue->price++;
$issue->countMin = 0;
}
$issue->save();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question