K
K
Konstantin2018-09-09 21:04:51
Yii
Konstantin, 2018-09-09 21:04:51

Why is DbDependency not working?

Good afternoon.
Need help cache is working fine.
But I can’t understand DbDependency either it works, or no,
I need the table to be updated when updated_at changes.
What's wrong, who knows?

$db = User::getDb();
        $dep = new DbDependency();
        $dep->sql = "SELECT MAX(updated_at) FROM user";
        $result = $db->cache(function ($db) {
            return User::find()->all($db);
        }, 600, $dep);

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question