Hello! Phalcon 3.4.0 I have two related models: UserSellerDealings as Sellers with reusable relation in UserSellerDealings
$this->belongsTo(
'sellerId',
'Abka\\Business\\Models\\Sellers',
'id',
[
'alias' => 'Seller',
'foreignKey' => [
'action' => Relation::ACTION_RESTRICT,
'message' => 'Продавца не существует',
],
'reusable' => true,
]
);
Then i run code
$model = ModelsUserSellerDealings::findFirstById(17198);
print_r($model->seller->property); // see property value 'someValue'
// then i update related records by raw query (or code from outside, another process, ets...)
$rawQuery = '
UPDATE sellers
SET property='newValue'
WHERE id=:sellerId
';
$this->db->query($rawQuery, ['sellerId' => $dealingsModel->seller->id]);
print_r($model->seller->property); // see property value 'someValue'
Expected behavior, I see the old value. If the "reusable" parameter is turned off, then we will see a new value. I studied the source code (Model and Manager) and saw that related data is stored in an associative array.
But if I create a new model, then the cache remains in it!
$model = ModelsUserSellerDealings::findFirstById(17198);
print_r($model->seller->property); // see property value 'someValue'
I don’t understand how this happens. I use models in workers and have unpredictable behavior and risk of cache overflowIs. it possible to globally reset the cache of related models?