Issues (76)

jobs/UpdateAccountJob.php (1 issue)

1
<?php /** @noinspection ALL */
2
3
/**
4
 * Created for IG Monitoring.
5
 * User: jakim <[email protected]>
6
 * Date: 11.01.2018
7
 */
8
9
namespace app\jobs;
10
11
12
use app\components\services\AccountUpdater;
13
use app\models\Account;
14
use Yii;
15
use yii\queue\JobInterface;
16
17
class UpdateAccountJob implements JobInterface
18
{
19
    public $id;
20
21
    /**
22
     * @param \yii\queue\Queue $queue
23
     * @throws \yii\base\Exception
24
     * @throws \yii\base\InvalidConfigException
25
     * @throws \Throwable
26
     */
27
    public function execute($queue)
28
    {
29
        $account = Account::findOne($this->id);
30
        if ($account) {
0 ignored issues
show
$account is of type yii\db\ActiveRecord, thus it always evaluated to true.
Loading history...
31
32
            $service = Yii::createObject([
33
                'class' => AccountUpdater::class,
34
                'account' => $account,
35
            ]);
36
            $service->run();
37
        }
38
    }
39
}