We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

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;
};

http://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.