We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Refreshing model metadata during development

Is there a way to reset the model metadata on every request?

This is possible for the views but I can't find in the docs to setup up the same thing for the model metadata.



98.9k
Accepted
answer

You can use the Memory adapter for meta-data:

<?php

$di['modelsMetadata'] = function() {
    $metaData = new \Phalcon\Mvc\Model\MetaData\Memory();
    return $metaData;
};

https://docs.phalcon.io/en/latest/reference/models.html#caching-meta-data

I think if you don't set up any modelsMetadata, then the metaData gets refreshed every request.